package com.handinfo.android.ui.window;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

import android.R.integer;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.widget.Toast;

import com.handinfo.android.DWGameActivity;
import com.handinfo.android.DWGameManager;
import com.handinfo.android.core.graphics.DWFont;
import com.handinfo.android.core.graphics.DWGraphics;
import com.handinfo.android.core.object.Actor;
import com.handinfo.android.core.object.Animation;
import com.handinfo.android.core.object.IGameHandler;
import com.handinfo.android.core.object.Scene.SceneHandler;
import com.handinfo.android.game.Achievement;
import com.handinfo.android.game.ActorBuffer;
import com.handinfo.android.game.Cell;
import com.handinfo.android.game.GameActor;
import com.handinfo.android.game.GameActorConstants;
import com.handinfo.android.game.IShortcutObject;
import com.handinfo.android.game.IconManger;
import com.handinfo.android.game.Login;
import com.handinfo.android.game.Npc;
import com.handinfo.android.game.Role;
import com.handinfo.android.game.Task;
import com.handinfo.android.game.particle.Particle;
import com.handinfo.android.game.particle.ParticleConstants;
import com.handinfo.android.game.skill.RoleCombatSkill;
import com.handinfo.android.game.skill.SkillConstants;
import com.handinfo.android.ui.ChatItem;
import com.handinfo.android.ui.IUIWindows;
import com.handinfo.android.ui.PickItem;
import com.handinfo.android.ui.SimpleRole;
import com.handinfo.android.ui.UIWindows;
import com.handinfo.android.uicontrols.DWCharsDetection;
import com.handinfo.android.uicontrols.DWControlTools;
import com.handinfo.android.uicontrols.DWControlsManager;
import com.handinfo.android.uicontrols.DWExternalDraw;
import com.handinfo.android.uicontrols.DWListener;
import com.handinfo.android.uicontrols.DWLongListener;
import com.handinfo.android.uicontrols.controls.DWAnimationBox;
import com.handinfo.android.uicontrols.controls.DWBackground;
import com.handinfo.android.uicontrols.controls.DWButton;
import com.handinfo.android.uicontrols.controls.DWControl;
import com.handinfo.android.uicontrols.controls.DWFrame;
import com.handinfo.android.uicontrols.controls.DWGrid;
import com.handinfo.android.uicontrols.controls.DWImageBox;
import com.handinfo.android.uicontrols.controls.DWInputBox;
import com.handinfo.android.uicontrols.controls.DWLabel;
import com.handinfo.android.uicontrols.controls.DWListSubItem;
import com.handinfo.android.uicontrols.controls.DWListbox;
import com.handinfo.android.uicontrols.controls.DWMessageBox;
import com.handinfo.android.uicontrols.controls.DWPercentBar;
import com.handinfo.android.uicontrols.controls.DWStretchBox;
import com.handinfo.android.uicontrols.controls.DWTabControl;
import com.handinfo.android.uicontrols.controls.DWTabPage;
import com.handinfo.android.uicontrols.controls.DWTextbox;
import com.handinfo.android.uicontrols.controls.DWTitle;
import com.handinfo.android.uicontrols.controls.DWVirtualKey;
//import com.handinfo.android.utils.ChannelOperation;
import com.handinfo.android.utils.Tools;

public class UIMain implements IUIWindows
{
	private long sysTime = 0;
	private DWImageBox m_cannot_touch = null;
	public static DWFrame m_Uimain_Frame = null;
	public DWAnimationBox aBox = null; //被选中人物
	public DWImageBox m_zhurenwu = null;//主人物头像（自己）
	private Bitmap m_zhurenwu_jiannan = null;
	private Bitmap m_zhurenwu_wunan = null;
	private Bitmap m_zhurenwu_daonan = null;
	private Bitmap m_zhurenwu_jiannv = null;
	private Bitmap m_zhurenwu_wunv = null;
	private Bitmap m_zhurenwu_daonv = null;
	private Bitmap m_tongji_bk = null;
	public boolean m_tongji_buff = false;
	public DWTextbox m_tongjibuff_time;
	public DWImageBox m_tongji;
	public long m_tongji_time = 0;
	private int m_zhurenwu_sex = 0;//自己的性别
	private int m_zhurenwu_vocation = 0;//自己的阵营
//	private DWLabel m_text_zhurenwu = null;//自己名字
	private DWLabel m_lb_lv = null;//自己等级
	private DWPercentBar m_main_pb_xue = null;//自己血条
	private DWPercentBar m_main_pb_lan = null;//自己蓝条
	private DWLabel m_text_point = null;//当前坐标
	private DWLabel m_text_location = null;//地图（场景）名字
	private DWImageBox m_imageBox_location = null;
	private Bitmap m_bm_location = null;

	///任务提示区
	public DWBackground m_task_background = null;
	public DWImageBox m_task_back = null;//悬浮在list上面用于点击
	public DWListbox m_task_listBox = null;
	public DWImageBox m_task_close = null;
	private Bitmap m_bm_close = null;

	//自己相关
	private Role role = null;//人物对象
	public IShortcutObject[] m_main_roleskill = new IShortcutObject[6];//技能
	public IShortcutObject m_bigSkill = null;
	//buff 与 debuff
	private DWGrid[] m_grid_main_buff = new DWGrid[10];//自己的buff
	private DWGrid[] m_grid_target_buff = new DWGrid[10];//目标身上buff
	private Bitmap m_bm_buff = null;
	//经验条
	private DWPercentBar m_pBar_exp = null;
	private Bitmap m_bm_jingyantiao = null;
	//怒气条
	private Bitmap m_bm_nuqishang = null;
	private Bitmap m_bm_nuqixia = null;
	private DWImageBox[] m_imageBox_nuqi = new DWImageBox[10];//定位10格子
	//队伍图标
	private DWImageBox m_imageBox_team = null;
	private Bitmap m_bm_near = null;
	private DWLabel[] m_text_team = new DWLabel[3];
	private DWPercentBar[] m_pbar_team = new DWPercentBar[5];//队伍中人物血条
	private DWImageBox[] m_main_team = new DWImageBox[3];//队伍类表图标(底图)
	private DWImageBox[] m_iamgeBox_team = new DWImageBox[3];//队伍人物头形象
	public Bitmap m_team_jiannan = null;
	public Bitmap m_team_wunan = null;
	public Bitmap m_team_daonan = null;
	public Bitmap m_team_jiannv = null;
	public Bitmap m_team_wunv = null;
	public Bitmap m_team_daonv = null;
	//活动(小助手)
	public DWImageBox m_imageBox_huodong = null;
	public Bitmap m_bm_huodong = null;
//	public boolean m_dingshi_flag = true;
	//运营活动
	public DWImageBox m_imageBox_yunying = null;
	//颁奖
	public DWImageBox m_imageBox_banjiang = null;
	public Bitmap m_bm_banjiang = null;
	public DWTextbox m_label_banjiang = null;
	//成就
	public DWImageBox m_imageBox_chengjiu = null;
	public Bitmap m_bm_chengjiu = null;
	public DWTextbox m_label_chengjiu = null;
	//附近玩家
	private DWImageBox m_imageBox_nearby = null;
	private Bitmap m_bm_nearby = null;
	//领奖提示
	public DWImageBox m_imageBox_lingjiang = null;
	private Bitmap m_bm_lingjiang = null;
	public DWLabel m_lable_lingjiang = null;
	//维修
	private DWImageBox m_imageBox_fix = null;
	private Bitmap m_bm_fix = null;
	//被选中人物底图
	private DWBackground m_bacBackground_checked = null;
	private DWLabel m_checked_lv = null;
	private Bitmap m_bm_checked = null;
	private DWLabel m_text_checked = null;//选中对象名字
	private DWPercentBar m_checked_xue = null;//选中（目标）血条
	//右下图标底(技能操作)
	private Bitmap m_bm_tubiao = null;
	public DWGrid[] m_grid_dizi = new DWGrid[6];
	private DWImageBox[] m_imageBox_shiti = new DWImageBox[6];
	private Bitmap m_bm_chiyaoditu = null;
	private Bitmap m_bm_zuoqiditu = null;
	//大招图片
	private Bitmap m_bm_dazhao = null;
	private Actor m_actor_dazhao_head = null;
	private Actor m_actor_dazhao_center = null;
	private DWAnimationBox m_animBox_dazhao_head = null;
	private DWAnimationBox m_animBox_dazhao_center = null;
	private DWGrid m_grid_dazhao = null;
	private int m_time = 0;
	private int m_time_total = 0;
//	private DWPercentBar m_pBar_dazhao = null;
	public long m_valib_time = 0;
	private boolean time_flag = true;
	//技能
	private DWPercentBar m_pBar_skill = null;
	private DWLabel m_text_skill = null;
	private int m_total = 0;
	private boolean m_skill_flag = false;
	private int m_curr = 0;
	private Bitmap m_skill_ditu = null;
	private Bitmap m_skill_jindu = null;

	private DWTitle m_UiTitle = null;
	public DWStretchBox m_main_sb01 = null;//收缩盒子
	public DWStretchBox m_main_sb02 = null;

	public DWStretchBox m_main_chengjiu = null;//收缩盒子成就

//	private DWStretchBox m_liaotianshou = null;
	boolean flag = false;//收缩盒子的状态标识
	boolean flag1 = false;

	private static final int M_IMAGE_NUM = 51;
	public DWImageBox[] m_MainImageBox = new DWImageBox[M_IMAGE_NUM];//主界面图片
	public Bitmap[] m_MainBitmap = new Bitmap[M_IMAGE_NUM];
	public static DWImageBox m_renwuanniu = null; // 任务提示 切换按钮
	public DWBackground m_jingji_bg = null;
	public DWTextbox m_jingji_tb = null;
	private DWVirtualKey m_VirtualKey = null;//虚拟摇杆
	private int m_virtual_time = 0;
	//下面图标的联合背景(xia)
	private DWBackground m_background_middle = null;
	private DWBackground m_background_left = null;
	private DWBackground m_background_right = null;
	private Bitmap m_bm_middle = null;
	private Bitmap m_bm_left = null;
	private Bitmap m_bm_right = null;
	//下面图标的联合背景(shang)
	private DWBackground m_background_middle_shang = null;
	private DWBackground m_background_left_shang = null;
	private DWBackground m_background_right_shang = null;
	private Bitmap m_bm_middle_shang = null;
	private Bitmap m_bm_left_shang = null;
	private Bitmap m_bm_right_shang = null;
	//主人物
	private int m_main_hp = 0;
	private int m_main_maxHp = 0;
	private int m_main_mp = 0;
	private int m_main_maxMp = 0;
	private int m_main_lv = 0;
	//选中目标
	private int m_checked_hp = 0;
	private int m_checked_maxHp = 0;
	//拾取
	private DWImageBox[] m_imageBox_pickup = new DWImageBox[5];
	private Bitmap m_bm_pickup = null;
	//宠物的默认图标
	public DWImageBox m_iamgeBox_chongwu = null;
	public Bitmap m_bm_chongwu = null;

	//喊话
	private DWImageBox m_imageBox_hanhua = null;
	private DWTabControl m_tc_hanhua = null;
	private DWTabPage m_tabPage_hanhua = null;
	private DWTextbox m_textBox_hanhua = null;
	private Bitmap m_bm_xitong = null;
	private Bitmap m_bm_chouhen = null;
	private Bitmap m_bm_fennu = null;
	private Bitmap m_bm_ganji = null;
	private Bitmap m_bm_chicheng = null;
	private Actor m_actor_chicheng = null;
	private Actor m_actor_fennu = null;
	private Actor m_actor_chouhenleft = null;
	private Actor m_actor_chouhenright = null;
	private Actor m_actor_ganji = null;
	private Actor m_actor_ganji1 = null;
	private DWAnimationBox m_ab_chicheng = null;//赤诚
	private DWAnimationBox m_ab_fennu = null;//愤怒
	private DWAnimationBox m_ab_chouhenleft = null;//
	private DWAnimationBox m_ab_chouhenright = null;//
	private DWAnimationBox m_ab_ganji = null;//
	private DWAnimationBox m_ab_ganji1 = null;//

	public Bitmap m_main_siliao = null;

//	public boolean open_flag = false;
	private byte m_main_shangcheng = 0; //商城
	public byte m_main_yaoqianshu = 1;//摇钱树
	public byte m_main_jitian = 2;//祭天
	public byte m_main_lianhun = 3;//炼魂
	public byte m_main_gongfang = 4;//工坊
	public byte m_main_liandan = 5;//炼丹
	public byte m_main_gonglue = 6;//排行
	public byte m_main_youxirenwu = 7;//任务
	public byte m_main_fuben = 8;//副本
	public byte m_main_beibao = 9;//背包
	public byte m_main_renwu = 10;//人物
	public byte m_main_jiazu = 11;//家族
	public byte m_main_jineng = 12;//技能
	public byte m_main_shejiao = 13;//社交
	public byte m_main_shezhi = 14;//设置
	private byte m_main_jineng01 = 15;//技能01（右侧快捷键01）
	private byte m_main_jineng02 = 16;//技能02（右侧快捷键02）
	private byte m_main_jineng03 = 17;//吃药
	private byte m_main_chiyao = 18;//坐骑
	private byte m_main_zuoqi = 19;//技能03
	private byte m_main_zidong = 20;//自动设置
	private byte m_main_zhurenwu = 21;//人物头像框
	private byte m_main_xuanzhong = 22;//选中人物头像
	private byte m_main_zhubuff = 23;//自己人物buff
	private byte m_main_xuanbuff = 24;//选中人物buff
	private byte m_main_duiwu01 = 25;//队伍人物01
	private byte m_main_duiwu02 = 26;//队伍人物02
	private byte m_main_duiwu03 = 27;//队伍人物03
	public byte m_main_youjian = 28;//邮件
	private byte m_main_yaogan01 = 29;//虚拟摇杆(大图)
	public byte m_main_xiayincang = 30;//下面的隐藏键
//	private byte m_main_liaotiankuang = 31;//聊天框
	public byte m_main_liaotiananniu = 32;//聊天按钮
	public byte m_main_xiaoditu = 33;//小地图
	private byte m_main_dituxia = 34;//小地图下（待定）
	private byte m_main_xiayincangback = 35;
	private byte m_main_nengliang = 36;//能量条(背景)
	private byte m_main_xuetiao = 37;//血条（血条背景）
	private byte m_main_touxiang = 38;//人物头像
	private byte m_main_jingyan = 39;//经验条
	private byte m_main_dituming = 40;//小地图名
	private byte m_main_xianxue = 41;//进度条(红条)
	private byte m_main_xianlan = 42;//进度条（蓝条）
	private byte m_main_xuanzhongxue = 43;//被选中人物的血条
	private byte m_main_duiwuxue01 = 44;//队伍血条1
	private byte m_main_duiwuxue02 = 45;//队伍血条2
	private byte m_main_duiwuxue03 = 46;//队伍血条3
	private byte m_main_yaogan02 = 47;//虚拟摇杆（小图）
	private byte m_main_chongwu = 48;//宠物
	private byte m_main_shangyinchang = 49;//上隐藏
	private byte m_main_buf01 = 50;//buf

	private Bitmap m_bm_yaoqianshu = null;
	private Bitmap m_bm_gongfang = null;
	private Bitmap m_bm_fuben = null;
	private Bitmap m_bm_paihang = null;
	private Bitmap m_bm_jitiantai = null;
	private Bitmap m_bm_liandan = null;
	private Bitmap m_bm_lianhun = null;

	private Bitmap m_bm_zuoqi = null;//坐骑图标(亮)
	public Bitmap m_bm_haveMail = null;//有新邮件时候的图标
	private DWLabel m_label_showtime = null;//时间显示
	private DWLabel m_label_fight = null;//是否在战斗

	private int change = 0;
	private int x = 0;
	private int y = 0;

	long a1 = 0;
	long m_sys_time = System.currentTimeMillis();
	private int m_x = 0;
	private int m_system_x = 0;

	private int m_jishu = 0;
	public boolean m_flag = false; ///判断任务提示区域是否收起

	/**
	 * 聊天外显
	 */
	DWTextbox m_chat_lb = null;
	DWTabPage m_chat_page = null;
	DWBackground m_chat_bg = null;

	public void uiMainPut()
	{
		if (DWControlsManager.getInstance().contains(m_Uimain_Frame)) {
			reset();
			return;
		}
		else {
			if (m_Uimain_Frame != null) {
				DWControlsManager.getInstance().addControl(m_Uimain_Frame);
				reset();
				return;
			}
		}
//		m_flag = true;
		a1 = System.currentTimeMillis();
		m_Uimain_Frame = new DWFrame(DWGameManager.Screen_Width, DWGameManager.Screen_Height);
		m_Uimain_Frame.m_null_frame = true;
		m_Uimain_Frame.setClickClose(false);
		m_Uimain_Frame.setThrough(true);
		m_Uimain_Frame.setShield(true);
		m_UiTitle = new DWTitle("", m_Uimain_Frame);
		//防止场景被触摸(右下)
		m_cannot_touch = new DWImageBox(m_bm_near);
		m_cannot_touch.setShowWideHigh(DWGameManager.Screen_Width / 5, DWGameManager.Screen_Height * 5 / 12);
		m_cannot_touch.setShow(false);
		m_cannot_touch.setNearAnchor(m_Uimain_Frame, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, 0, 0);
		m_Uimain_Frame.addControl(m_cannot_touch);
		//任务提示区
		m_task_background = new DWBackground(DWGameManager.Screen_Width / 5,
				DWGameManager.Screen_Height * 5 / 24);
		m_task_background.setNearAnchor(m_Uimain_Frame, Tools.RIGHT_TOP, Tools.RIGHT_TOP, 0,
				DWGameManager.Screen_Height / 3);

		m_task_listBox = new DWListbox(m_task_background.getShowWidth(), m_task_background.getShowHeight());
		m_task_listBox.setShowBackgroundRect(false);
//		m_task_listBox.addListener(m_task_tiem);
		m_task_listBox.setNearAnchor(m_task_background, Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 0);

		m_animBox_renwu = new DWAnimationBox(m_task_Actor);
		switch (DWGameManager.AdpaterType) {
			case DWGameManager.AD_HIGH:
				m_animBox_renwu.setNearAnchor(m_task_background, Tools.LEFT_TOP, Tools.LEFT_TOP, 120, -25);
				break;
			default:
				m_animBox_renwu.setNearAnchor(m_task_background, Tools.LEFT_TOP, Tools.LEFT_TOP, 75, -50);
				break;
		}
		m_animBox_renwu.setShowWideHigh(10, 100);
		m_animBox_renwu.setShow(false);
		m_animBox_renwu.setTouch(false);

		m_task_close = new DWImageBox(m_bm_close);
		m_task_close.setTouchZoomIn(20, 20);
		m_task_close.setShow(false);
		m_task_close.setTouch(false);
		m_task_close.addListener(m_close);
		m_task_close.setNearAnchor(m_task_background, Tools.RIGHT_BOTTOM, Tools.RIGHT_TOP, 0, 0);

		m_task_back = new DWImageBox(m_MainBitmap[m_main_renwu]);
		m_task_back.setShowWideHigh(DWGameManager.Screen_Width / 5,
				DWGameManager.Screen_Height * 5 / 24);
		m_task_back.setNearAnchor(m_task_background, Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 0);
		m_task_back.setShow(false);
		m_task_back.setTouch(false);

		m_Uimain_Frame.addControl(m_task_background);
		m_Uimain_Frame.addControl(m_task_listBox);
		m_Uimain_Frame.addControl(m_task_back);
		m_Uimain_Frame.addControl(m_task_close);
		m_Uimain_Frame.addControl(m_animBox_renwu);

		refreshTask();

		// 底层一排
		m_MainImageBox[m_main_renwu] = new DWImageBox(
				m_MainBitmap[m_main_renwu]);
		m_MainImageBox[m_main_renwu].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_renwu].setNearAnchor(m_Uimain_Frame,
				Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM,
				-DWGameManager.Screen_Width * 9 / 40,
				-10);

		////聊天框
		float wide = DWFont.getDefaultFont().stringWidth("国") * 51 / 3;
		m_chat_page = new DWTabPage();
		m_chat_page.setSelect(true);
		m_chat_page.setShowWideHigh((int) wide, (int) (DWFont.getDefaultFont().getFontHeight() * 3 + 6));
		m_chat_page.setNearAnchor(m_MainImageBox[m_main_renwu], Tools.LEFT_BOTTOM, Tools.LEFT_TOP, 0, -5);
		m_chat_lb = new DWTextbox("", (int) wide);
		m_chat_lb.setNearAnchor(m_chat_page, Tools.LEFT_BOTTOM, Tools.LEFT_BOTTOM, 0, 0);
		m_chat_page.addControls(m_chat_lb);
		m_chat_bg = new DWBackground(UIWindows.createImage("/img/newui/liaotianwaixian_1.gnp"), m_chat_page
				.getShowWidth() + 10, m_chat_page.getShowHeight());
		m_chat_bg.setNearAnchor(m_chat_page, Tools.LEFT_TOP, Tools.LEFT_TOP, -5, 0);
		ChatUpdate();

		m_MainImageBox[m_main_beibao] = new DWImageBox(
				m_MainBitmap[m_main_beibao]);
		m_MainImageBox[m_main_beibao].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_beibao].setNearAnchor(
				m_MainImageBox[m_main_renwu], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 3 / 40, 0);

		m_MainImageBox[m_main_jiazu] = new DWImageBox(
				m_MainBitmap[m_main_jiazu]);
		m_MainImageBox[m_main_jiazu].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_jiazu].setNearAnchor(
				m_MainImageBox[m_main_beibao], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 3 / 40, 0);

		m_MainImageBox[m_main_jineng] = new DWImageBox(
				m_MainBitmap[m_main_jineng]);
		m_MainImageBox[m_main_jineng].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_jineng].setNearAnchor(
				m_MainImageBox[m_main_jiazu], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 3 / 40, 0);

		m_MainImageBox[m_main_shejiao] = new DWImageBox(
				m_MainBitmap[m_main_shejiao]);
		m_MainImageBox[m_main_shejiao].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_shejiao].setNearAnchor(
				m_MainImageBox[m_main_jineng], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 3 / 40, 0);

		m_MainImageBox[m_main_shezhi] = new DWImageBox(
				m_MainBitmap[m_main_shezhi]);
		m_MainImageBox[m_main_shezhi].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_shezhi].setNearAnchor(
				m_MainImageBox[m_main_shejiao], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 3 / 40, 0);
		// 右侧
		m_imageBox_shiti[0] = new DWImageBox(
				m_MainBitmap[m_main_jineng01]);
		m_imageBox_shiti[0].setShowWideHigh(DWGameManager.Screen_Width * 57 / 800,
				DWGameManager.Screen_Height * 19 / 160);
		m_imageBox_shiti[0].setNearAnchor(
				m_Uimain_Frame,
				Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -DWGameManager.Screen_Width * 13 / 80,
				-DWGameManager.Screen_Height / 48);

		m_imageBox_shiti[1] = new DWImageBox(
				m_MainBitmap[m_main_jineng02]);
		m_imageBox_shiti[1].setShowWideHigh(DWGameManager.Screen_Width * 57 / 800,
				DWGameManager.Screen_Height * 19 / 160);
		m_imageBox_shiti[1].setNearAnchor(
				m_imageBox_shiti[0], Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, DWGameManager.Screen_Width * 21 / 800,
				-DWGameManager.Screen_Height * 61 / 240);

		m_imageBox_shiti[2] = new DWImageBox(
				m_MainBitmap[m_main_jineng03]);
		m_imageBox_shiti[2].setShowWideHigh(DWGameManager.Screen_Width * 57 / 800,
				DWGameManager.Screen_Height * 19 / 160);
		m_imageBox_shiti[2].setNearAnchor(
				m_imageBox_shiti[1], Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, DWGameManager.Screen_Width * 35 / 800,
				-DWGameManager.Screen_Height * 61 / 240);

		m_imageBox_shiti[3] = new DWImageBox(
				m_bm_chiyaoditu);
//		m_imageBox_shiti[3].setShow(false);
//		m_imageBox_shiti[3].setTouch(false);
		m_imageBox_shiti[3].setShowWideHigh(DWGameManager.Screen_Width * 57 / 800,
				DWGameManager.Screen_Height * 19 / 160);
		m_imageBox_shiti[3].setNearAnchor(
				m_imageBox_shiti[2], Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, DWGameManager.Screen_Width * 31 / 400,
				-DWGameManager.Screen_Height / 6);

		m_imageBox_shiti[4] = new DWImageBox(
				m_bm_zuoqiditu);
//		m_imageBox_shiti[4].setShow(false);
//		m_imageBox_shiti[4].setTouch(false);
		m_imageBox_shiti[4].setShowWideHigh(DWGameManager.Screen_Width * 57 / 800,
				DWGameManager.Screen_Height * 19 / 160);
		m_imageBox_shiti[4].setNearAnchor(
				m_imageBox_shiti[3], Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, -DWGameManager.Screen_Width * 3 / 800,
				DWGameManager.Screen_Height / 48);

		m_imageBox_shiti[5] = new DWImageBox(
				m_bm_tubiao);
		m_imageBox_shiti[5].setShow(false);
//		m_imageBox_shiti[5].setTouch(false);
		m_imageBox_shiti[5].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25, DWGameManager.Screen_Height * 2 / 15);
		m_imageBox_shiti[5].setNearAnchor(
				m_imageBox_shiti[4], Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, -DWGameManager.Screen_Width / 160,
				DWGameManager.Screen_Height / 60);

		//右侧实体图标(等待添加对象，暂时只是图标显示)
		m_grid_dizi[0] = new DWGrid(m_bm_tubiao);
		m_grid_dizi[0].setDarg(true);
		m_grid_dizi[0].setNearAnchor(m_imageBox_shiti[0], Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		m_grid_dizi[1] = new DWGrid(m_bm_tubiao);
		m_grid_dizi[1].setDarg(true);
		m_grid_dizi[1].setNearAnchor(m_imageBox_shiti[1], Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		m_grid_dizi[2] = new DWGrid(m_bm_tubiao);
		m_grid_dizi[2].setDarg(true);
		m_grid_dizi[2].setNearAnchor(m_imageBox_shiti[2], Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		m_grid_dizi[3] = new DWGrid(m_bm_chiyaoditu);
		m_grid_dizi[3].setDarg(true);
//		m_grid_dizi[3].setImage(m_MainBitmap[m_main_chiyao]);//固定图标和功能
		m_grid_dizi[3].setNearAnchor(m_imageBox_shiti[3], Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		m_grid_dizi[4] = new DWGrid(m_bm_zuoqiditu);
		m_grid_dizi[4].setDarg(true);
//		m_grid_dizi[4].setImage(m_MainBitmap[m_main_zuoqi]);//固定图标和功能
		m_grid_dizi[4].setNearAnchor(m_imageBox_shiti[4], Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		m_grid_dizi[5] = new DWGrid(m_MainBitmap[m_main_zidong]);
		m_grid_dizi[5].setDarg(true);
//		m_grid_dizi[5].setShow(false);
//		m_grid_dizi[5].setTouch(false);
//		m_grid_dizi[5].setImage(m_MainBitmap[m_main_zidong]);//固定图标和功能
		m_grid_dizi[5].setNearAnchor(m_imageBox_shiti[5], Tools.HCENTER_VCENTER,
				Tools.HCENTER_VCENTER, 0, 0);

		//底层背景(xia)
		m_background_middle = new DWBackground(m_bm_middle, DWGameManager.Screen_Width * 350 / 800,
				DWGameManager.Screen_Height * 5 / 48);
		m_background_middle.setNearAnchor(m_MainImageBox[m_main_renwu], Tools.LEFT_BOTTOM, Tools.LEFT_BOTTOM, 0, 0);

		m_background_right = new DWBackground(m_bm_right, DWGameManager.Screen_Width / 40,
				DWGameManager.Screen_Height * 5 / 48);///8
		m_background_right.setNearAnchor(m_background_middle, Tools.LEFT_TOP, Tools.RIGHT_TOP,
				0, 0);

		m_background_left = new DWBackground(m_bm_left, DWGameManager.Screen_Width / 40,
				DWGameManager.Screen_Height * 5 / 48);
		m_background_left.setNearAnchor(m_background_middle, Tools.RIGHT_TOP, Tools.LEFT_TOP,
				0, 0);

		// 其他不按顺序的控件摆放
		// 主人物窗口
		m_MainImageBox[m_main_zhurenwu] = new DWImageBox(
				m_MainBitmap[m_main_zhurenwu]);
//		m_MainImageBox[m_main_zhurenwu].setShowWideHigh(DWGameManager.Screen_Width * 203 / 800,
//				DWGameManager.Screen_Height * 3 / 16);
		m_MainImageBox[m_main_zhurenwu].setNearAnchor(m_Uimain_Frame,
				Tools.LEFT_TOP, Tools.LEFT_TOP,
				0, 0);

		//等级提示
		m_lb_lv = new DWLabel("");
		m_lb_lv.setFont(DWFont.getFont(16));
//		m_lb_lv.setShowWideHigh(40, 25);
		m_lb_lv.setShowBackground(false);
		m_lb_lv.setTextColor(Color.WHITE);
		if (DWGameManager.AdpaterType == 2) {
			m_lb_lv.setNearAnchor(m_MainImageBox[m_main_zhurenwu], Tools.LEFT_TOP, Tools.LEFT_TOP,
					DWGameManager.Screen_Width * 7 / 800, DWGameManager.Screen_Height / 160);
		}
		else {
			m_lb_lv.setNearAnchor(m_MainImageBox[m_main_zhurenwu], Tools.LEFT_TOP, Tools.LEFT_TOP, 5, 2);
		}

		//宠物(底图)
		m_MainImageBox[m_main_chongwu] = new DWImageBox(
				m_MainBitmap[m_main_chongwu]);
//		m_MainImageBox[m_main_chongwu].setShowWideHigh(DWGameManager.Screen_Width * 19 / 200,
//				DWGameManager.Screen_Height * 21 / 160);
		m_MainImageBox[m_main_chongwu].setNearAnchor(
				m_MainImageBox[m_main_zhurenwu], Tools.LEFT_TOP,
				Tools.LEFT_BOTTOM, -DWGameManager.Screen_Width * 3 / 800, -DWGameManager.Screen_Height / 160);
		if (DWGameManager.AdpaterType == 2) {
			m_MainImageBox[m_main_chongwu].setNearAnchor(
					m_MainImageBox[m_main_zhurenwu], Tools.LEFT_TOP,
					Tools.LEFT_BOTTOM, -DWGameManager.Screen_Width * 3 / 800, -DWGameManager.Screen_Height / 160);
		}
		//宠物图标
		m_iamgeBox_chongwu = new DWImageBox(m_bm_chongwu);
		m_iamgeBox_chongwu.setNearAnchor(m_MainImageBox[m_main_chongwu], Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER,
				-4, 0);

		// 队伍中人物列表
		for (int i = 0; i < 3; i++) {
			//队伍底图
			m_main_team[i] = new DWImageBox(m_MainBitmap[m_main_duiwu01]);
			m_main_team[i].setShow(false);
			m_main_team[i].setTouch(false);
			m_main_team[i].setShowWideHigh(DWGameManager.Screen_Width * 111 / 800,
					DWGameManager.Screen_Height * 11 / 96);
			m_main_team[i].setNearAnchor(
					m_MainImageBox[m_main_chongwu], Tools.LEFT_BOTTOM,
					Tools.LEFT_BOTTOM, 0,
					m_main_team[i].getShowHeight() * (i + 1));
			//血条 50
			m_pbar_team[i] = new DWPercentBar(DWGameManager.Screen_Width / 16, m_MainBitmap[m_main_xianxue],
					m_MainBitmap[m_main_xuanzhongxue]);
			m_pbar_team[i].setShow(false);
			m_pbar_team[i].setTouch(false);
//			m_pbar_team[i].setPercent(20, 50);
			m_pbar_team[i].setNearAnchor(m_main_team[i], Tools.RIGHT_VCENTER,
					Tools.RIGHT_VCENTER, -DWGameManager.Screen_Width / 160, 0);//DWGameManager.Screen_Width/10
			//名字
			m_text_team[i] = new DWLabel("");
			m_text_team[i].setFont(DWFont.getFont(16));
			m_text_team[i].setTouch(false);
			m_text_team[i].setShow(false);
			m_text_team[i].setShowBackground(false);
			m_text_team[i].setTextColor(Color.WHITE);
			m_text_team[i].setNearAnchor(m_pbar_team[i], Tools.LEFT_TOP, Tools.LEFT_TOP, 0,
					-DWGameManager.Screen_Height / 24);
			//队伍人物头像
			m_iamgeBox_team[i] = new DWImageBox(m_team_daonan);
			m_iamgeBox_team[i].setShow(false);
			m_iamgeBox_team[i].setTouch(false);
			m_iamgeBox_team[i].setNearAnchor(m_main_team[i], Tools.HCENTER_BOTTOM, Tools.LEFT_BOTTOM, 35, -8);

			m_Uimain_Frame.addControl(m_main_team[i]);
			m_Uimain_Frame.addControl(m_pbar_team[i]);
			m_Uimain_Frame.addControl(m_text_team[i]);
			m_Uimain_Frame.addControl(m_iamgeBox_team[i]);
		}
		//大招
		m_animBox_dazhao_head = new DWAnimationBox(m_actor_dazhao_head);
		m_animBox_dazhao_head.setShowWideHigh(10, 100);
		m_animBox_dazhao_head.setShow(false);
		m_animBox_dazhao_head.setTouch(false);

		m_animBox_dazhao_center = new DWAnimationBox(m_actor_dazhao_center);
		m_animBox_dazhao_center.setShowWideHigh(50, 50);
		m_animBox_dazhao_center.setShow(false);
		m_animBox_dazhao_center.setTouch(false);
		m_animBox_dazhao_center.setNearAnchor(m_Uimain_Frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, -25);

		m_grid_dazhao = new DWGrid(m_bm_tubiao, 200, 100);
		m_grid_dazhao.setShow(false);
		m_grid_dazhao.setTouch(false);
		m_grid_dazhao.addListener(m_dazhao);
		m_grid_dazhao.setNearAnchor(m_Uimain_Frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
//		m_pBar_dazhao = new DWPercentBar(300, m_MainBitmap[m_main_xianxue], m_MainBitmap[m_main_xuetiao]);
//		m_pBar_dazhao.setShow(false);
//		m_pBar_dazhao.setTouch(true);
//		m_pBar_dazhao.setNearAnchor(m_grid_dazhao, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 100);
		//技能
		int h = DWFont.getDefaultFont().getHeight() + 10;
		int y = DWGameManager.Screen_Height - 96 - h;

		m_pBar_skill = new DWPercentBar(200, m_skill_jindu, m_skill_ditu);
		m_pBar_skill.setShow(false);
		m_pBar_skill.setTouch(false);
		m_pBar_skill.setNearAnchor(m_Uimain_Frame, Tools.LEFT_TOP, Tools.LEFT_TOP,
				DWGameManager.Screen_Width - 200 >> 1, y - h);

		m_text_skill = new DWLabel("");
		m_text_skill.setShowWideHigh(200, 25);
		m_text_skill.setShow(false);
		m_text_skill.setTouch(false);
		m_text_skill.setShowBackground(false);
		m_text_skill.setTextColor(Color.YELLOW);

		// 队伍图标
//		m_imageBox_team = new DWImageBox(
//				m_bm_team);
//		m_imageBox_team.setNearAnchor(
//				m_MainImageBox[m_main_youjian], Tools.LEFT_VCENTER,
//				Tools.RIGHT_VCENTER, 10, 0);
		//附近其他玩家
		m_imageBox_nearby = new DWImageBox(
				m_bm_near);
		m_imageBox_nearby.setNearAnchor(
				m_MainImageBox[m_main_chongwu], Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 10, 0);
		//活动
		m_imageBox_huodong = new DWImageBox(
				m_bm_huodong);
		m_imageBox_huodong.setNearAnchor(
				m_imageBox_nearby, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 10, 0);
		//运营
		m_imageBox_yunying = new DWImageBox(
				m_bm_huodong);
		m_imageBox_yunying.setShow(false);
		m_imageBox_yunying.setTouch(false);
		m_imageBox_yunying.setNearAnchor(
				m_imageBox_huodong, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 10, 0);
		m_imageBox_yunying.addListener(UIWindows.getInstance().m_assistant.m_yunying_listener);
		m_Uimain_Frame.addControl(m_imageBox_yunying);

		//颁奖
		m_imageBox_banjiang = new DWImageBox(m_bm_banjiang);
		m_imageBox_banjiang.setShow(false);
		m_imageBox_banjiang.setTouch(false);
		m_imageBox_banjiang.setNearAnchor(m_imageBox_yunying, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, -48, 0);
		m_Uimain_Frame.addControl(m_imageBox_banjiang);

		m_label_banjiang = new DWTextbox("123");
		m_label_banjiang.setShow(false);
		m_label_banjiang.setTouch(false);
		m_label_banjiang.setNearAnchor(m_imageBox_banjiang, Tools.HCENTER_TOP, Tools.HCENTER_BOTTOM, 0, 0);
		m_Uimain_Frame.addControl(m_label_banjiang);

//		m_label_chengjiu = new DWTextbox("123");
//		m_label_chengjiu.setShow(false);
//		m_label_chengjiu.setTouch(false);
//		m_label_chengjiu.setNearAnchor(m_imageBox_chengjiu, Tools.HCENTER_TOP, Tools.HCENTER_BOTTOM, 0, 0);
//		m_Uimain_Frame.addControl(m_label_chengjiu);

		// 邮件提示
		m_MainImageBox[m_main_youjian] = new DWImageBox(
				m_MainBitmap[m_main_youjian]);
		m_MainImageBox[m_main_youjian].setNearAnchor(
				m_MainImageBox[m_main_chongwu], Tools.LEFT_TOP,
				Tools.LEFT_BOTTOM, 0, 10);
		m_MainImageBox[m_main_youjian].setTouchZoomIn(10, 10);

		//维修
		m_imageBox_fix = new DWImageBox(m_bm_fix);
		m_imageBox_fix.setShow(false);
		m_imageBox_fix.setNearAnchorUn(m_MainImageBox[m_main_youjian], Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 10, 0);
		m_Uimain_Frame.addControl(m_imageBox_fix);

		m_VirtualKey = new DWVirtualKey(m_MainBitmap[m_main_yaogan01],
				m_MainBitmap[m_main_yaogan02]);
		m_VirtualKey.setShow(false);
		m_VirtualKey.setTouch(false);
//		m_VirtualKey.setNearAnchor(
//				m_Uimain_Frame, Tools.LEFT_BOTTOM,
//				Tools.LEFT_BOTTOM, 40, -50);

		// 下隐藏
		m_MainImageBox[m_main_xiayincang] = new DWImageBox(
				m_MainBitmap[m_main_xiayincang]);
//		m_MainImageBox[m_main_xiayincang].setShowWideHigh(DWGameManager.Screen_Width * 47 / 800,
//				DWGameManager.Screen_Height * 13 / 160);
		m_MainImageBox[m_main_xiayincang].setTouchZoomIn(0, DWGameManager.Screen_Height / 24);
		m_MainImageBox[m_main_xiayincang].addListener(m_xiayin);
		m_MainImageBox[m_main_xiayincang].setNearAnchor(
				m_MainImageBox[m_main_shezhi], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 5 / 80, 10);

		// 聊天(框)
//		m_MainImageBox[m_main_liaotiankuang] = new DWImageBox(
//				m_MainBitmap[m_main_liaotiankuang]);
//		m_MainImageBox[m_main_liaotiankuang].setNearAnchor(
//				m_MainImageBox[m_main_beibao], Tools.HCENTER_TOP,
//				Tools.HCENTER_BOTTOM, 90, -15);
		// 聊天（按钮)
		m_MainImageBox[m_main_liaotiananniu] = new DWImageBox(
				m_MainBitmap[m_main_liaotiananniu]);
		m_MainImageBox[m_main_liaotiananniu].setShowWideHigh(DWGameManager.Screen_Width * 47 / 800,
				DWGameManager.Screen_Height / 12);
		m_MainImageBox[m_main_liaotiananniu].setNearAnchor(
				m_MainImageBox[m_main_xiayincang], Tools.HCENTER_BOTTOM,
				Tools.HCENTER_BOTTOM, -DWGameManager.Screen_Width / 80, -DWGameManager.Screen_Height / 8);

		//小地图名称底图
		m_imageBox_location = new DWImageBox(m_bm_location);
		m_imageBox_location.setNearAnchor(m_Uimain_Frame, Tools.RIGHT_TOP, Tools.RIGHT_TOP, 0, 0);
		m_Uimain_Frame.addControl(m_imageBox_location);
		//坐标
		m_text_point = new DWLabel("");
		if (DWGameManager.AdpaterType == 2) {
			m_text_point.setFont(DWFont.getFont(24));
		}
		else {
			m_text_point.setFont(DWFont.getFont(18));
		}
		m_text_point.setShowBackground(false);
		m_text_point.setTextColor(Color.WHITE);

		//地图名称
		m_text_location = new DWLabel("");
		if (DWGameManager.AdpaterType == 2) {
			m_text_location.setFont(DWFont.getFont(24));
		}
		else {
			m_text_location.setFont(DWFont.getFont(18));
		}
		m_text_location.setShowBackground(false);
		m_text_location.setTextColor(Color.WHITE);

		// 小地图
		m_MainImageBox[m_main_xiaoditu] = new DWImageBox(
				m_MainBitmap[m_main_xiaoditu]);
//		m_MainImageBox[m_main_xiaoditu].setShowWideHigh(m_MainImageBox[m_main_xiaoditu].getShowWidth()*13/19,
//				m_MainImageBox[m_main_xiaoditu].getShowHeight()*9/10);
		m_MainImageBox[m_main_xiaoditu].setNearAnchor(
				m_imageBox_location, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, 0);

		m_MainImageBox[m_main_xiaoditu].addExternalDraw(m_small_map);
		SMALL_MAP_X = m_MainImageBox[m_main_xiaoditu].getShowX() + 3;
		SMALL_MAP_Y = m_MainImageBox[m_main_xiaoditu].getShowY() + 3;
		SMALL_MAP_W = m_MainImageBox[m_main_xiaoditu].getShowWidth() - 6;
		SMALL_MAP_H = m_MainImageBox[m_main_xiaoditu].getShowHeight() - 6;
		SCALED_DOWN_X = (float) SMALL_MAP_W / (float) DWGameManager.Screen_Width;
		SCALED_DOWN_Y = (float) SMALL_MAP_H / (float) DWGameManager.Screen_Height;

//		m_MainImageBox[m_main_xiaoditu].setShow(false);

//		第一排

		m_MainImageBox[m_main_shangcheng] = new DWImageBox(
				m_MainBitmap[m_main_shangcheng]);
		m_MainImageBox[m_main_shangcheng].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_shangcheng].setNearAnchor(
				m_imageBox_location, Tools.RIGHT_TOP,
				Tools.LEFT_TOP, -20, 0);

		m_MainImageBox[m_main_youxirenwu] = new DWImageBox(
				m_MainBitmap[m_main_youxirenwu]);
		m_MainImageBox[m_main_youxirenwu].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_youxirenwu].setNearAnchor(
				m_MainImageBox[m_main_shangcheng], Tools.RIGHT_TOP,
				Tools.LEFT_TOP, -20, 0);

		m_MainImageBox[m_main_yaoqianshu] = new DWImageBox(
				m_bm_yaoqianshu);
//		m_MainImageBox[m_main_yaoqianshu].setTouch(false);
		m_MainImageBox[m_main_yaoqianshu].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_yaoqianshu].setNearAnchor(
				m_MainImageBox[m_main_youxirenwu], Tools.RIGHT_TOP, Tools.LEFT_TOP,
				-5, 0);

		m_MainImageBox[m_main_gongfang] = new DWImageBox(
				m_bm_gongfang);
//		m_MainImageBox[m_main_gongfang].setTouch(false);
		m_MainImageBox[m_main_gongfang].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_gongfang].setNearAnchor(
				m_MainImageBox[m_main_yaoqianshu], Tools.RIGHT_TOP, Tools.LEFT_TOP,
				-5, 0);

		m_MainImageBox[m_main_fuben] = new DWImageBox(
				m_bm_fuben);
//		m_MainImageBox[m_main_fuben].setTouch(false);
		m_MainImageBox[m_main_fuben].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_fuben].setNearAnchor(
				m_MainImageBox[m_main_gongfang], Tools.RIGHT_TOP, Tools.LEFT_TOP,
				-5, 0);

		m_MainImageBox[m_main_gonglue] = new DWImageBox(m_MainBitmap[m_main_gonglue]
				);
//		m_MainImageBox[m_main_gonglue].setTouch(false);
		m_MainImageBox[m_main_gonglue].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_gonglue].setNearAnchor(
				m_MainImageBox[m_main_youxirenwu], Tools.HCENTER_TOP,
				Tools.HCENTER_BOTTOM, 0, DWGameManager.Screen_Height / 96);

		m_MainImageBox[m_main_jitian] = new DWImageBox(
				m_bm_jitiantai);
//		m_MainImageBox[m_main_jitian].setTouch(false);
		m_MainImageBox[m_main_jitian].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_jitian].setNearAnchor(
				m_MainImageBox[m_main_gonglue], Tools.RIGHT_TOP, Tools.LEFT_TOP,
				-5, 0);

		m_MainImageBox[m_main_liandan] = new DWImageBox(
				m_bm_liandan);
//		m_MainImageBox[m_main_liandan].setTouch(false);
		m_MainImageBox[m_main_liandan].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_liandan].setNearAnchor(
				m_MainImageBox[m_main_jitian], Tools.RIGHT_TOP, Tools.LEFT_TOP,
				-5, 0);

		m_MainImageBox[m_main_lianhun] = new DWImageBox(
				m_bm_lianhun);
//		m_MainImageBox[m_main_lianhun].setTouch(false);
		m_MainImageBox[m_main_lianhun].setShowWideHigh(DWGameManager.Screen_Width * 2 / 25,
				DWGameManager.Screen_Height * 2 / 15);
		m_MainImageBox[m_main_lianhun].setNearAnchor(
				m_MainImageBox[m_main_liandan], Tools.RIGHT_TOP, Tools.LEFT_TOP,
				-5, 0);

		///向上隐藏
		m_MainImageBox[m_main_shangyinchang] = new DWImageBox(m_MainBitmap[m_main_shangyinchang]);
		m_MainImageBox[m_main_shangyinchang].setShowWideHigh(DWGameManager.Screen_Width * 47 / 800,
				DWGameManager.Screen_Height * 13 / 160);
		m_MainImageBox[m_main_shangyinchang].setTouchZoomIn(0, DWGameManager.Screen_Height / 24);
		m_MainImageBox[m_main_shangyinchang].addListener(m_shangyin);
		m_MainImageBox[m_main_shangyinchang].setNearAnchor(
				m_MainImageBox[m_main_gongfang], Tools.RIGHT_VCENTER,
				Tools.RIGHT_VCENTER, DWGameManager.Screen_Width * 3 / 40, 0);

		//领取奖品
		m_imageBox_lingjiang = new DWImageBox(m_bm_lingjiang);
		m_imageBox_lingjiang.setShow(false);
		m_imageBox_lingjiang.setNearAnchor(m_MainImageBox[m_main_shangcheng], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 0);
		m_Uimain_Frame.addControl(m_imageBox_lingjiang);

		//成就
		m_imageBox_chengjiu = new DWImageBox(m_bm_chengjiu);
		m_imageBox_chengjiu.setShow(false);
		m_imageBox_chengjiu.setTouch(false);
		m_imageBox_chengjiu.setNearAnchor(m_MainImageBox[m_main_shangcheng], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 0);
		m_Uimain_Frame.addControl(m_imageBox_chengjiu);

		//领奖倒计时
		m_lable_lingjiang = new DWLabel("");
		m_lable_lingjiang.setTouch(false);
		m_lable_lingjiang.setShow(false);
		if (DWGameManager.AdpaterType == 2) {
			m_lable_lingjiang.setFont(DWFont.getFont(24));
		}
		else {
			m_lable_lingjiang.setFont(DWFont.getFont(18));
		}
		m_lable_lingjiang.setShowBackground(false);
		m_lable_lingjiang.setTextColor(Color.WHITE);
		m_Uimain_Frame.addControl(m_lable_lingjiang);

		//底层背景（shang）
		m_background_middle_shang = new DWBackground(m_bm_middle_shang, DWGameManager.Screen_Width * 11 / 40,
				DWGameManager.Screen_Height * 5 / 18);
		m_background_middle_shang.setNearAnchor(m_MainImageBox[m_main_fuben], Tools.LEFT_TOP, Tools.LEFT_TOP,
				DWGameManager.Screen_Width * 9 / 400, -DWGameManager.Screen_Height / 96);
		m_background_right_shang = new DWBackground(m_bm_right_shang, DWGameManager.Screen_Width * 9 / 160, 140);
		m_background_right_shang.setNearAnchor(m_background_middle_shang, Tools.RIGHT_TOP, Tools.RIGHT_TOP,
				DWGameManager.Screen_Width * 9 / 160, -DWGameManager.Screen_Height / 96);

		m_background_left_shang = new DWBackground(m_bm_left_shang, DWGameManager.Screen_Width * 9 / 160, 140);
		m_background_left_shang.setNearAnchor(m_background_middle_shang, Tools.LEFT_TOP, Tools.LEFT_TOP,
				-DWGameManager.Screen_Width * 9 / 160, -DWGameManager.Screen_Height / 96);

		m_background_middle_shang.setShow(false);
		m_background_right_shang.setShow(false);
		m_background_left_shang.setShow(false);

		// 小地图下
		m_renwuanniu = new DWImageBox(
				m_MainBitmap[m_main_dituxia]);
		m_renwuanniu.setTouchZoomIn(20, 20);
		//	m_renwuanniu.setShowWideHigh(DWGameManager.Screen_Width * 2 / 25, DWGameManager.Screen_Height * 2 / 15);
		m_renwuanniu.setNearAnchor(
				m_Uimain_Frame, Tools.RIGHT_TOP,
				Tools.RIGHT_TOP, 0, DWGameManager.Screen_Height / 3 - 18);

		DWTextbox m_jingji_tb_1 = new DWTextbox("家族竞技场名：剩余100人");
		m_jingji_bg = new DWBackground(m_jingji_tb_1.getShowWidth() + 10, 2 * m_jingji_tb_1.getShowHeight() + 10);
		m_jingji_bg.setNearAnchor(m_Uimain_Frame, Tools.RIGHT_VCENTER, Tools.RIGHT_VCENTER, 0, -10);

		m_jingji_tb = new DWTextbox("家族1家族2" + DWControlTools.CHANGE_ROW + "家族2");
		m_jingji_tb.setNearAnchor(m_jingji_bg, Tools.LEFT_TOP, Tools.LEFT_TOP, 5, 5);
		m_jingji_bg.setShow(false);
		m_jingji_tb.setShow(false);

		//选中
		m_checked_xue = new DWPercentBar(50, m_MainBitmap[m_main_xianxue],
				m_MainBitmap[m_main_xuanzhongxue]);
		m_checked_xue.setShow(false);
		m_checked_xue.setTouch(false);

		// 血条
		if (DWGameManager.AdpaterType == 2) {
			m_main_pb_xue = new DWPercentBar(130, m_MainBitmap[m_main_xianxue],
					m_MainBitmap[m_main_xuetiao]);

			m_main_pb_xue.setNearAnchor(m_MainImageBox[m_main_zhurenwu],
					Tools.LEFT_TOP, Tools.LEFT_TOP, 140,
					40);
		}
		else {
			m_main_pb_xue = new DWPercentBar(91, m_MainBitmap[m_main_xianxue],
					m_MainBitmap[m_main_xuetiao]);

			m_main_pb_xue.setNearAnchor(m_MainImageBox[m_main_zhurenwu],
					Tools.LEFT_TOP, Tools.LEFT_TOP, 90,
					25);
		}

		//蓝条(格子条)
		for (int i = 0; i < 10; i++) {
			m_imageBox_nuqi[i] = new DWImageBox(m_bm_nuqixia);
			m_imageBox_nuqi[i].setNearAnchor(m_main_pb_xue,
					Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 9 * i, 5);
			if (DWGameManager.AdpaterType == 2) {
				m_imageBox_nuqi[i].setNearAnchor(m_main_pb_xue,
						Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 13 * i, 5);
			}
		}

		// 怒气条
		if (DWGameManager.AdpaterType == 2) {
			m_main_pb_lan = new DWPercentBar(130, m_MainBitmap[m_main_xianlan],
					m_MainBitmap[m_main_xuetiao]);
		}
		else {
			m_main_pb_lan = new DWPercentBar(91, m_MainBitmap[m_main_xianlan],
					m_MainBitmap[m_main_xuetiao]);
		}
		m_main_pb_lan.setNearAnchor(m_imageBox_nuqi[0],
				Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 5);

		m_animBox_dazhao_head.setNearAnchor(m_main_pb_xue, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, -20);
		//自己身上的buff
		for (int i = 0; i < 5; i++) {
			m_grid_main_buff[i] = new DWGrid(0, 0, 20, 20);
			m_grid_main_buff[i].setDarg(true);
//			m_grid_main_buff[i].setShow(false);
			m_grid_main_buff[i].setTouch(false);
			m_grid_main_buff[i].setNearAnchor(m_MainImageBox[m_main_zhurenwu],
					Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM, -10 + 23 * i,
					0);
		}

		for (int i = 5; i < 10; i++) {
			m_grid_main_buff[i] = new DWGrid(0, 0, 20, 20);
			m_grid_main_buff[i].setDarg(true);
			m_grid_main_buff[i].setShow(false);
			m_grid_main_buff[i].setTouch(false);
			m_grid_main_buff[i].setNearAnchor(m_grid_main_buff[0],
					Tools.LEFT_TOP, Tools.LEFT_TOP, 23 * (i - 5),
					20);
		}

		// 头像
		m_zhurenwu = new DWImageBox(m_zhurenwu_daonan);
		m_zhurenwu.setNearAnchor(
				m_MainImageBox[m_main_zhurenwu], Tools.HCENTER_BOTTOM,
				Tools.LEFT_BOTTOM, 50, 0);
		if (DWGameManager.AdpaterType == 2) {
			m_zhurenwu.setNearAnchor(
					m_MainImageBox[m_main_zhurenwu], Tools.HCENTER_BOTTOM,
					Tools.LEFT_BOTTOM, 80, 0);
		}
		//根据职业和性别判定自己头像
		m_zhurenwu_sex = DWGameManager.getInstance().m_role.m_sex;
		m_zhurenwu_vocation = DWGameManager.getInstance().m_role.m_vocation;
		if (m_zhurenwu_sex == 1 && m_zhurenwu_vocation == 1) {//剑男
			m_zhurenwu.setBackground(m_zhurenwu_jiannan, true);
		}
		else if (m_zhurenwu_sex == 1 && m_zhurenwu_vocation == 2) {//武男
			m_zhurenwu.setBackground(m_zhurenwu_wunan, true);
		}
		else if (m_zhurenwu_sex == 1 && m_zhurenwu_vocation == 3) {//道男
			m_zhurenwu.setBackground(m_zhurenwu_daonan, true);
		}
		else if (m_zhurenwu_sex == 2 && m_zhurenwu_vocation == 1) {//剑女
			m_zhurenwu.setBackground(m_zhurenwu_jiannv, true);
		}
		else if (m_zhurenwu_sex == 2 && m_zhurenwu_vocation == 2) {//武女
			m_zhurenwu.setBackground(m_zhurenwu_wunv, true);
		}
		else if (m_zhurenwu_sex == 2 && m_zhurenwu_vocation == 3) {//道女
			m_zhurenwu.setBackground(m_zhurenwu_daonv, true);
		}
		//通缉令BUFF

		m_tongji = new DWImageBox(m_tongji_bk);
		m_tongji.setShowWideHigh(96, (int) DWFont.getFont(16).getHeight() + 4);
		m_tongji.setTouch(false);
		m_tongji.setShow(false);
		m_tongji.setNearAnchor(m_MainImageBox[m_main_zhurenwu], Tools.LEFT_TOP, Tools.LEFT_TOP, 0, (m_zhurenwu
				.getShowHeight()
				- m_tongji.getShowHeight() >> 1) + 5);

		m_tongjibuff_time = new DWTextbox("<mark c=EEF5A8>" + "虚弱：10:10" + "</mark>");
		m_tongjibuff_time.setFont(DWFont.getFont(16));
		m_tongjibuff_time.setTouch(false);
		m_tongjibuff_time.setShow(false);
		m_tongjibuff_time.setNearAnchor(m_tongji, Tools.LEFT_TOP, Tools.LEFT_TOP, 2, m_tongji.getShowHeight()
				- m_tongjibuff_time.getShowHeight() >> 1);

		//自己名字
//		m_text_zhurenwu = new DWLabel(DWGameManager.getInstance().m_role.m_name);
//		m_text_zhurenwu.setShowWideHigh(125, 25);
//		m_text_zhurenwu.setShowBackground(false);
//		m_text_zhurenwu.setTextColor(Color.WHITE);
//		m_text_zhurenwu.setNearAnchor(m_MainImageBox[m_main_zhurenwu], Tools.LEFT_TOP, Tools.LEFT_TOP, 80, 0);

		// 经验条
		m_pBar_exp = new DWPercentBar(DWGameManager.Screen_Width * 391 / 400, m_bm_jingyantiao,
				m_MainBitmap[m_main_jingyan]);
		m_pBar_exp.setNearAnchor(m_Uimain_Frame,
				Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM, 0,
				0);
		// 地图名
//		m_MainImageBox[m_main_dituming] = new DWImageBox(
//				m_MainBitmap[m_main_dituming]);
//		m_MainImageBox[m_main_dituming].setShowWideHigh(DWGameManager.Screen_Width * 41 / 800,
//				DWGameManager.Screen_Height / 30);
//		m_MainImageBox[m_main_dituming].setNearAnchor(
//				m_MainImageBox[m_main_xiaoditu], Tools.HCENTER_TOP,
//				Tools.HCENTER_BOTTOM, 0, -DWGameManager.Screen_Height * 25 / 96);

		//被选中人物底图
		m_bacBackground_checked = new DWBackground(m_bm_checked, 111,
				55);
		m_bacBackground_checked.setShow(false);
		m_bacBackground_checked.setTouch(false);
		m_bacBackground_checked.setNearAnchor(m_MainImageBox[m_main_zhurenwu], Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, 0, 0);

		//被选中人物
		aBox = new DWAnimationBox();
		aBox.setTouch(false);
		aBox.setNearAnchor(
				m_bacBackground_checked, Tools.LEFT_BOTTOM,
				Tools.LEFT_BOTTOM, 0, -10);
		m_checked_xue.setNearAnchor(
				aBox, Tools.LEFT_VCENTER,
				Tools.RIGHT_VCENTER, -8, 50);
		//选择人物等级
		m_checked_lv = new DWLabel("");
//		m_checked_lv.setShow(false);
		m_checked_lv.setTouch(false);
		m_checked_lv.setShowBackground(false);
		m_checked_lv.setTextColor(Color.WHITE);
		m_checked_lv.setFont(DWFont.getFont(16));
		m_checked_lv.setNearAnchor(m_checked_xue, Tools.LEFT_TOP, Tools.LEFT_TOP, 0,
				-DWGameManager.Screen_Height / 24);

		//被选中人物（目标）buff
		for (int i = 0; i < 4; i++) {
			m_grid_target_buff[i] = new DWGrid(m_bm_buff);
			m_grid_target_buff[i].setDarg(true);
			m_grid_target_buff[i].setShow(false);
			m_grid_target_buff[i].setTouch(false);
			m_grid_target_buff[i].setNearAnchor(m_checked_xue, Tools.LEFT_TOP, Tools.LEFT_TOP, 23 * i, 15);
		}
		for (int i = 4; i < 7; i++) {
			m_grid_target_buff[i] = new DWGrid(m_bm_buff);
			m_grid_target_buff[i].setDarg(true);
			m_grid_target_buff[i].setShow(false);
			m_grid_target_buff[i].setTouch(false);
			m_grid_target_buff[i]
					.setNearAnchor(m_grid_target_buff[0], Tools.LEFT_TOP, Tools.LEFT_TOP, 23 * (i - 4), 23);
		}
		for (int i = 7; i < 10; i++) {
			m_grid_target_buff[i] = new DWGrid(m_bm_buff);
			m_grid_target_buff[i].setDarg(true);
			m_grid_target_buff[i].setShow(false);
			m_grid_target_buff[i].setTouch(false);
			m_grid_target_buff[i]
					.setNearAnchor(m_grid_target_buff[4], Tools.LEFT_TOP, Tools.LEFT_TOP, 23 * (i - 7), 23);
		}

		m_text_checked = new DWLabel("");
		m_text_checked.setFont(DWFont.getFont(16));
		m_text_checked.setShowBackground(false);
		m_text_checked.setTextColor(Color.WHITE);
		m_text_checked.setNearAnchor(m_checked_xue, Tools.LEFT_TOP, Tools.LEFT_TOP, 25,
				-DWGameManager.Screen_Height / 24);

		m_Uimain_Frame.addControl(m_bacBackground_checked);
		m_Uimain_Frame.addControl(m_checked_lv);
		m_Uimain_Frame.addControl(aBox);
		m_Uimain_Frame.addControl(m_checked_xue);
		m_Uimain_Frame.addControl(m_text_checked);

		//时间显示和是否在战斗
		m_label_showtime = new DWLabel("");
		if (DWGameManager.AdpaterType == 2) {
			m_label_showtime.setFont(DWFont.getFont(24));
		}
		else {
			m_label_showtime.setFont(DWFont.getFont(16));
		}
		m_label_showtime.setShowBackground(false);
		m_label_showtime.setTextColor(Color.WHITE);
		m_Uimain_Frame.addControl(m_label_showtime);

		m_label_fight = new DWLabel("");
		if (DWGameManager.AdpaterType == 2) {
			m_label_fight.setFont(DWFont.getFont(24));
		}
		else {
			m_label_fight.setFont(DWFont.getFont(16));
		}

		m_label_fight.setShowBackground(false);
		m_label_fight.setTextColor(Color.WHITE);
		m_Uimain_Frame.addControl(m_label_fight);

		m_Uimain_Frame.addControl(m_jingji_bg);
		m_Uimain_Frame.addControl(m_jingji_tb);

		//拾取
//		for(int i = 0; i<5;i++){
//			m_imageBox_pickup[i] = new DWImageBox(m_bm_pickup);
//			m_imageBox_pickup[i].setPoint(200+65*i, 250);
//		}
//		mm = new DWImageBox(m_bm_pickup);
//		mm.setPoint(270, 410);
		//收缩
		m_main_sb01 = new DWStretchBox(Tools.BOTTOM, m_MainImageBox[m_main_shangcheng].getShowHeight() + 10);
		m_main_sb02 = new DWStretchBox(Tools.TOP, m_MainImageBox[m_main_shangcheng].getShowHeight() * 2 + 20);
		m_main_sb01.setStretchTime(30);
		m_main_sb02.setState(true);
		m_main_sb02.setStretchTime(30);
//		m_liaotianshou = new DWStretchBox(Tools.BOTTOM, m_MainImageBox[m_main_shangcheng].getShowHeight());
//		m_liaotianshou.setStretchTime(30);
//		m_liaotianshou.setState(true);
		flag = false;
		flag1 = true;
		m_Uimain_Frame.addControl(m_main_sb01);
		m_Uimain_Frame.addControl(m_main_sb02);

		m_Uimain_Frame.addControl(m_MainImageBox[m_main_youjian]);
		m_Uimain_Frame.addControl(m_MainImageBox[m_main_xiayincang]);
		m_Uimain_Frame.addControl(m_MainImageBox[m_main_shangcheng]);
		m_Uimain_Frame.addControl(m_MainImageBox[m_main_liaotiananniu]);
		m_Uimain_Frame.addControl(m_MainImageBox[m_main_xiaoditu]);
		m_Uimain_Frame.addControl(m_MainImageBox[m_main_chongwu]);
		m_Uimain_Frame.addControl(m_MainImageBox[m_main_zhurenwu]);

		m_Uimain_Frame.addControl(m_imageBox_shiti[3]);
		m_Uimain_Frame.addControl(m_imageBox_shiti[4]);
		m_Uimain_Frame.addControl(m_imageBox_shiti[5]);
		for (int i = 0; i < 6; i++) {
			m_Uimain_Frame.addControl(m_grid_dizi[i]);
		}
		for (int i = 0; i < 10; i++) {
			m_Uimain_Frame.addControl(m_imageBox_nuqi[i]);
		}
		for (int i = 0; i < 10; i++) {
			m_Uimain_Frame.addControl(m_grid_main_buff[i]);
		}
		for (int i = 0; i < 10; i++) {
			m_Uimain_Frame.addControl(m_grid_target_buff[i]);
		}

		m_Uimain_Frame.addControl(m_pBar_exp);
		m_Uimain_Frame.addControl(m_animBox_dazhao_center);
		m_Uimain_Frame.addControl(m_grid_dazhao);
//		m_Uimain_Frame.addControl(m_pBar_dazhao);
//		m_Uimain_Frame.addControl(m_imageBox_team);
		m_Uimain_Frame.addControl(m_imageBox_huodong);
		m_Uimain_Frame.addControl(m_imageBox_nearby);

//		m_Uimain_Frame.removeControl(m_MainImageBox[m_main_liaotiankuang]);//暂时不显示

		//下背景加入收缩
		m_main_sb01.addControl(m_background_middle);
		m_main_sb01.addControl(m_background_right);
		m_main_sb01.addControl(m_background_left);
		m_main_sb01.addControl(m_MainImageBox[m_main_renwu]);
		m_main_sb01.addControl(m_MainImageBox[m_main_beibao]);
		m_main_sb01.addControl(m_MainImageBox[m_main_jiazu]);
		m_main_sb01.addControl(m_MainImageBox[m_main_jineng]);
		m_main_sb01.addControl(m_MainImageBox[m_main_shejiao]);
		m_main_sb01.addControl(m_MainImageBox[m_main_shezhi]);
		m_main_sb01.addControl(m_chat_bg);
		m_main_sb01.addControl(m_chat_page);
//		m_liaotianshou.addControl(m_chat_lb[0]);
//		m_liaotianshou.addControl(m_chat_lb[1]);
		m_main_sb02.addControl(m_background_middle_shang);
		m_main_sb02.addControl(m_background_right_shang);
		m_main_sb02.addControl(m_background_left_shang);
//		m_main_sb02.addControl(m_MainImageBox[m_main_shangcheng]);//
		m_main_sb02.addControl(m_MainImageBox[m_main_yaoqianshu]);
		m_main_sb02.addControl(m_MainImageBox[m_main_jitian]);
		m_main_sb02.addControl(m_MainImageBox[m_main_lianhun]);
		m_main_sb02.addControl(m_MainImageBox[m_main_gongfang]);
		m_main_sb02.addControl(m_MainImageBox[m_main_liandan]);
		m_main_sb02.addControl(m_MainImageBox[m_main_youxirenwu]);
		m_main_sb02.addControl(m_MainImageBox[m_main_fuben]);
		m_main_sb02.addControl(m_MainImageBox[m_main_gonglue]);

//		m_Uimain_Frame.removeControl(m_MainImageBox[m_main_liaotiankuang]);
//		m_Uimain_Frame.addControl(m_text_zhurenwu);
		m_Uimain_Frame.addControl(m_text_point);
		m_Uimain_Frame.addControl(m_text_location);
		m_Uimain_Frame.addControl(m_main_pb_xue);
		m_Uimain_Frame.addControl(m_main_pb_lan);
		m_Uimain_Frame.addControl(aBox);
		m_Uimain_Frame.addControl(m_zhurenwu);
		m_Uimain_Frame.addControl(m_tongji);
		m_Uimain_Frame.addControl(m_tongjibuff_time);
		m_Uimain_Frame.addControl(m_lb_lv);
		m_Uimain_Frame.addControl(m_animBox_dazhao_head);
		m_Uimain_Frame.addControl(m_VirtualKey);
		for (int i = 0; i < 5; i++) {
			m_Uimain_Frame.addControl(m_imageBox_pickup[i]);
		}
		m_Uimain_Frame.addControl(m_iamgeBox_chongwu);
		m_Uimain_Frame.addControl(m_pBar_skill);
		m_Uimain_Frame.addControl(m_text_skill);
		m_Uimain_Frame.addControl(m_animBox_dazhao_head);
		DWControlsManager.getInstance().addControl(m_Uimain_Frame);
		refreshBackGround();
		reset();
		UIWindows.getInstance().m_main.open((byte) 1);
		UIWindows.getInstance().m_main.open((byte) 2);
		UIWindows.getInstance().m_main.open((byte) 3);
		showchengjiu();
		//监听
		//第一排监听
		m_MainImageBox[m_main_shangcheng].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				DWGameManager.getInstance().getSendMessage().sendOpenVipShop((byte) 1, (byte) 0);
//				UIWindows.getInstance().m_achie.open((byte)0);
			}
		});

		m_MainImageBox[m_main_yaoqianshu].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				role = DWGameManager.getInstance().m_role;
				if (role.m_lv < 5) {
					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "还未达到开启等级");
					return;
				}
				DWGameManager.getInstance().getSendMessage().sendYQSInto(DWGameManager.getInstance().m_role.m_gameId);
				DWGameManager.getInstance().getSendMessage().sendYQSFriendList(UISocial.SOCIAL_TYPE_FRIEND, (byte) 0,
						UIGetMoney.num);
			}
		});

		m_MainImageBox[m_main_jitian].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				role = DWGameManager.getInstance().m_role;
				if (role.m_lv < 15) {
					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "还未达到开启等级");
					return;
				}
				UIWindows.getInstance().m_jiming.open((byte) 0);
			}
		});

		m_MainImageBox[m_main_lianhun].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				role = DWGameManager.getInstance().m_role;
				if (role.m_lv < 12) {
					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "还未达到开启等级");
					return;
				}
				DWGameManager.getInstance().showToast("点击了炼魂", Toast.LENGTH_SHORT);

				DWGameManager.getInstance().getSendMessage().sendOpenSoulByIndex((byte) 0);
			}
		});

		m_MainImageBox[m_main_gongfang].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				role = DWGameManager.getInstance().m_role;
				if (role.m_lv < 10) {
					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "还未达到开启等级");
					return;
				}
				UIWindows.getInstance().m_tiangong.open((byte) 0);
			}
		});

		m_MainImageBox[m_main_liandan].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				role = DWGameManager.getInstance().m_role;
				if (role.m_lv < 25) {
					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "还未达到开启等级");
					return;
				}
				DWGameManager.getInstance().getSendMessage().sendNeiDangOpenWindow();
			}
		});

		//第二排
		//排行
		m_MainImageBox[m_main_gonglue].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}

				UIWindows.getInstance().m_rank.open((byte) 0);
			}
		});
		//任务
		m_MainImageBox[m_main_youxirenwu].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_renwu.open((byte) 0);
			}
		});
		//副本
		m_MainImageBox[m_main_fuben].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				role = DWGameManager.getInstance().m_role;
				if (role.m_lv < 12) {
					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "还未达到开启等级");
					return;
				}
				DWGameManager.getInstance().getSendMessage().sendGameCarbonOpen();
			}
		});

		//最底层
		m_MainImageBox[m_main_beibao].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_bag.open((byte) 0);
			}
		});
		//成就
		m_MainImageBox[m_main_renwu].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				m_imageBox_chengjiu.setShow(false);
				m_imageBox_chengjiu.setTouch(false);
//				UIWindows.getInstance().m_rolestats.open((byte) 0);
				UIWindows.getInstance().m_achie.open((byte) 0);
			}
		});

		m_MainImageBox[m_main_jiazu].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_family.open((byte) 0);
			}
		});

		m_MainImageBox[m_main_jineng].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_skill.open((byte) 0);
			}
		});
		//社交监听
		m_MainImageBox[m_main_shejiao].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{

				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				DWGameManager.getInstance().getSendMessage().sendSocialList(UISocial.SOCIAL_TYPE_FRIEND, 0,
						UISocial.num);
			}
		});

		m_MainImageBox[m_main_shezhi].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				UIWindows.getInstance().m_setup.open((byte) 1);
			}
		});
		//小地图 监听
		m_MainImageBox[m_main_xiaoditu].addListener(new DWListener() {

			public void OnDoubleClick()
			{

			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_map.open((byte) 0);
			}
		});

		//聊天
		m_MainImageBox[m_main_liaotiananniu].addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				m_MainImageBox[m_main_liaotiananniu].setBackground(m_MainBitmap[m_main_liaotiananniu], false);
//				DWGameManager.getInstance().getSendMessage().sendChatItemList();
				UIWindows.getInstance().m_liaotian.open((byte) 0);
				if (!DWGameManager.getInstance().m_role.m_siliao_ima_flag)
				{
					UIWindows.getInstance().m_liaotian.m_tabcontrol.setSelectPage(6);
					UIWindows.getInstance().m_liaotian.m_pindao_but.setName("私聊");
					DWGameManager.getInstance().m_role.m_siliao_ima_flag = true;
					Tools.debugPrintln("进入直接进入聊天私聊的判断中。");
					Tools.debugPrintln("Role的类的私聊判断标志3：" + DWGameManager.getInstance().m_role.m_siliao_ima_flag);
				}
			}
		});

//		//队伍监听
//		m_imageBox_team.addListener(new DWListener() {
//			public void OnDoubleClick()
//			{
//			}
//
//			public void OnClick()
//			{
//				UIWindows.getInstance().m_team.open((byte) 0);
//			}
//		});

		////活动(竞技)
		m_imageBox_huodong.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}

				DWGameManager.getInstance().getSendMessage().sendAssistantEverydayOpen();
				Tools.debugPrintln("点击进入日常活动。");

//				if (UIWindows.getInstance().m_assistant.m_assistant_type_1 == 0)
//				{
////					if (UIWindows.getInstance().m_assistant.m_assistant_type == 0)
////					{
////						DWGameManager.getInstance().getSendMessage().sendAssistantEverydayOpen();
////					}
////					else if (UIWindows.getInstance().m_assistant.m_assistant_type == 1)
////					{
////						DWGameManager.getInstance().getSendMessage().sendAssistantActivityOpen();
////						m_imageBox_huodong.setSelect(false);
////					}
//
//					DWGameManager.getInstance().getSendMessage().sendAssistantEverydayOpen();
//					Tools.debugPrintln("点击进入日常活动。");
//				}
//				else if (UIWindows.getInstance().m_assistant.m_assistant_type_1 == 1)
//				{
//					if (UIWindows.getInstance().m_assistant.m_assistant_icon_1 == 0)
//					{
//						DWGameManager.getInstance().getSendMessage().sendAssistantEverydayOpen();
//						Tools.debugPrintln("类型为1进入日常活动。");
//					}
//					else
//					{
//						DWGameManager.getInstance().getSendMessage().sendAssistantActivityOpen();
//						m_imageBox_huodong.setSelect(false);
//						Tools.debugPrintln("点击进入定时活动。");
//					}
////					m_dingshi_flag = false;
//				}
			}
		});

		////颁奖
		m_imageBox_banjiang.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_prize.open((byte) 0);
			}
		});

		////成就
		m_imageBox_chengjiu.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				//UIWindows.getInstance().m_achie.sendAchieve();
				m_imageBox_chengjiu.setShow(false);
				m_imageBox_chengjiu.setTouch(false);
				UIWindows.getInstance().m_achie.open((byte) 1);
			}
		});

		//附近人监听
		m_imageBox_nearby.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_nearby.open((byte) 0);

			}
		});

		//右侧
		//技能(grid 控件监听)
		m_grid_dizi[0].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (role != null) {
					if (m_main_roleskill[2] != null) {
						DWGameManager.getInstance().m_role.clearAutoAttack();
						IShortcutObject obj = DWGameManager.getInstance().m_role.getShortcutObject(2);
						obj.doShortcutAction(role);
						RoleCombatSkill skill = (RoleCombatSkill) obj;
						if (!skill.m_id
								.equals(SkillConstants.ID_GENERAL_SKILL[DWGameManager.getInstance().m_role.m_vocation])) {
							UIHook.closeHook();
						}
					}
					else {
						return;
					}
				}
				else {
					return;
				}

			}
		});

		m_grid_dizi[1].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (role != null) {
					if (m_main_roleskill[1] != null) {
						DWGameManager.getInstance().m_role.clearAutoAttack();
						IShortcutObject obj = DWGameManager.getInstance().m_role.getShortcutObject(1);
						obj.doShortcutAction(role);
						RoleCombatSkill skill = (RoleCombatSkill) obj;
						if (!skill.m_id
								.equals(SkillConstants.ID_GENERAL_SKILL[DWGameManager.getInstance().m_role.m_vocation])) {
							UIHook.closeHook();
						}
					}
					else {
						return;
					}
				}
				else {
					return;
				}
			}
		});

		m_grid_dizi[2].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (role != null) {
					if (m_main_roleskill[0] != null) {
						DWGameManager.getInstance().m_role.clearAutoAttack();
						IShortcutObject obj = DWGameManager.getInstance().m_role.getShortcutObject(0);
						obj.doShortcutAction(role);
						RoleCombatSkill skill = (RoleCombatSkill) obj;
						if (!skill.m_id
								.equals(SkillConstants.ID_GENERAL_SKILL[DWGameManager.getInstance().m_role.m_vocation])) {
							UIHook.closeHook();
						}
					}
					else {
						return;
					}
				}
				else {
					return;
				}
			}
		});
		//吃药
		m_grid_dizi[3].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (role != null) {
					if (m_main_roleskill[4] != null) {
						m_main_roleskill[4].doShortcutAction();
					}
					else {
						return;
					}
				}
				else {
					return;
				}

			}
		});
		//坐骑
		m_grid_dizi[4].addListener(new DWListener() {
			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (role != null) {
					if (m_main_roleskill[5] != null) {
						m_main_roleskill[5].doShortcutAction();
					}
					else {
						return;
					}
				}
				else {
					return;
				}

			}
		});

		//自动设置(暂时为自动打怪)
		m_grid_dizi[5].addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				UIWindows.getInstance().m_hook.open((byte) 0);
			}
		});

		//邮件监听
		m_MainImageBox[m_main_youjian].addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (!DWControlsManager.getInstance().contains(UIWindows.getInstance().m_mail.m_mail_Frame))
				{
					if (DWGameManager.getInstance().m_role.m_recvMails.size() >= 50)
					{
						final DWMessageBox mb = new DWMessageBox("温馨提示", "您的邮件已经达到50封上限，新邮件将无法显示，请尽快清理！", null, "确定");
						DWControlsManager.getInstance().addControl(mb);
						mb.addListener(new DWListener() {

							public void OnDoubleClick()
							{
							}

							public void OnClick()
							{
								if (mb.getResult() == DWMessageBox.SOFTKEY_BACK)
								{
									UIWindows.getInstance().m_main.showNewMial(false);
									UIWindows.getInstance().m_mail.Updata();
									UIWindows.getInstance().m_mail.open((byte) 0);
									Tools.debugPrintln("从对话框的确定创建邮件界面.");
									DWControlsManager.getInstance().removeControl(mb);
								}
							}
						});
					}
					else
					{
						UIWindows.getInstance().m_main.showNewMial(false);
						UIWindows.getInstance().m_mail.Updata();
						UIWindows.getInstance().m_mail.open((byte) 0);
						Tools.debugPrintln("没弹出对话框创建的界面.");
					}
				}
			}
		});
		//选中人物监听
		aBox.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				if (DWGameManager.getInstance().m_role.m_targetActor != null) {
					if (DWGameManager.getInstance().m_role.m_targetActor instanceof Role) {
						UIWindows.getInstance().m_checked.open((byte) 0);
					}
				}

			}
		});

		//任务提示窗口监听
		m_renwuanniu.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				m_Uimain_Frame.removeControl(m_renwuanniu);
				m_Uimain_Frame.addControl(m_task_background);
				m_Uimain_Frame.addControl(m_task_back);
				m_Uimain_Frame.addControl(m_task_listBox);
				m_Uimain_Frame.addControl(m_task_close);
				m_flag = false;
			}
		});
		m_Uimain_Frame.addLongListener(new DWLongListener() {
			public void OnLong(boolean isDown)
			{
				if (isDown) {
					UIHook.closeHook();
					if (DWGameManager.getInstance().m_role.isSellStatus()) {
						DWGameManager.getInstance().addSystemInfo(
								DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
						return;
					}
					m_VirtualKey.setShow(true);
					m_VirtualKey.setTouch(true);
					m_VirtualKey.m_is_open = true;
					m_VirtualKey.setPoint((int) (m_Uimain_Frame.m_click_x - m_VirtualKey.getShowWidth() / 2),
							(int) (m_Uimain_Frame.m_click_y - m_VirtualKey.getShowHeight() / 2));
				}
				else {
					m_VirtualKey.setShow(false);
					m_VirtualKey.setTouch(false);
					m_VirtualKey.m_is_open = false;
					role.stay(role.m_direct);
				}
			}
		});
		/// 十字键监听
		m_VirtualKey.addListener(new DWListener() {
			public void OnDoubleClick()
			{
				role.stay(role.m_direct);
			}

			public void OnClick()
			{
				UIHook.closeHook();
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
				float dx = m_VirtualKey.getOffsetX();
				float dy = m_VirtualKey.getOffsetY();
				if (dx == 0 && dy == 0) {
					return;
				}
				role.clearPathfinding();
				float hypotenuse = (float) Math.sqrt(dx * dx + dy * dy);
				float vx = dx * role.m_velocity / hypotenuse;
				float vy = dy * role.m_velocity / hypotenuse;
				role.move(vx, vy, role.m_velocity);
				m_virtual_time = 0;

			}
		});

		//宠物监听
		m_iamgeBox_chongwu.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
					DWGameManager.getInstance().addSystemInfo(
							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					return;
				}
//				if( open_flag == false){
				DWGameManager.getInstance().getSendMessage().sendChongWuOpenWin();
//				}

			}
		});
		//任务头像监听
		m_zhurenwu.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				if (DWGameManager.getInstance().m_role.isSellStatus()) {
//					DWGameManager.getInstance().addSystemInfo(
//							DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
					UIWindows.getInstance().m_baitan.sendBaitanChakan(DWGameManager.getInstance().m_role.m_gameId);
					return;
				}
				UIWindows.getInstance().m_bag.open((byte) 0);
			}
		});
//		Icon();

		//装备修理
		UIWindows.getInstance().m_fix.setDurableMessage();
	}

	//成就显示
	private Bitmap m_main_chengjiuimg;
	private Bitmap m_main_chengjiuname;
	private Bitmap m_main_chengjiudianshu;
	private Bitmap m_main_chengjiubk;
	public DWImageBox m_main_chengjiu1;
	public DWImageBox m_main_chengjiu2;
	public DWImageBox m_main_chengjiu3;
	public DWImageBox m_main_chengjiu4;
	public DWTextbox m_chengjiu_title;//成就名字

	public DWTextbox m_chengjiu_yaoqiu;//成就要求奖励
	public DWTextbox m_chengjiu_yaoqiu1;//成就要求奖励

	public DWTextbox m_chengjiu_ds;//成就点数

	public DWTextbox m_chengjiu_a;//成就距离

	public void showchengjiu()
	{
		//收缩
		m_main_chengjiu = new DWStretchBox(Tools.TOP, m_main_chengjiubk.getHeight() + m_main_chengjiuname.getHeight()
				/ 2 + 10);
		m_main_chengjiu.setStretchTime(5);
		m_main_chengjiu.setState(true);
		m_main_chengjiu.setShow(false);

		//绘制背景
		m_main_chengjiu1 = new DWImageBox(m_main_chengjiubk);
		m_main_chengjiu1.setNearAnchor(m_Uimain_Frame, Tools.LEFT_TOP, Tools.LEFT_TOP, m_Uimain_Frame.getShowWidth()
				- m_main_chengjiubk.getWidth() >> 1, m_main_chengjiuname.getHeight() / 2);
		//绘制标题
		m_main_chengjiu3 = new DWImageBox(m_main_chengjiuname);
		m_main_chengjiu3.setNearAnchor(m_main_chengjiu1, Tools.LEFT_TOP, Tools.LEFT_TOP, m_main_chengjiu1
				.getShowWidth()
				- m_main_chengjiuname.getWidth() >> 1, 0 - m_main_chengjiu3.getShowHeight() / 2);

		//成就名称
		m_chengjiu_title = new DWTextbox("<mark c=FFBB11>" + "成就" + "</mark>" + DWControlTools.CHANGE_ROW
				+ "`<mark c=FFBB11>" + "成就" + "</mark>");
		m_chengjiu_title.setNearAnchor(m_main_chengjiu1, Tools.LEFT_VCENTER, Tools.LEFT_VCENTER,
				DWGameManager.Screen_Width / 128 + DWGameManager.Screen_Width * 7 / 800, 0);

		//成就名称背景
		m_main_chengjiu2 = new DWImageBox(m_main_chengjiuimg);
		m_main_chengjiu2.setNearAnchor(m_chengjiu_title, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		//成就要求奖励
		m_chengjiu_yaoqiu = new DWTextbox("成就要求");
		m_chengjiu_yaoqiu.setNearAnchor(m_main_chengjiu2, Tools.LEFT_TOP, Tools.RIGHT_TOP, 10, 0);

		//奖励
		m_chengjiu_yaoqiu1 = new DWTextbox("奖励");
		m_chengjiu_yaoqiu1.setNearAnchor(m_chengjiu_yaoqiu, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 0);

		//成就点数
		m_main_chengjiu4 = new DWImageBox(m_main_chengjiudianshu);
		m_main_chengjiu4.setNearAnchor(m_chengjiu_yaoqiu1, Tools.LEFT_BOTTOM, Tools.RIGHT_BOTTOM, 10, 0);

		m_chengjiu_ds = new DWTextbox("0");
		m_chengjiu_ds.setNearAnchor(m_main_chengjiu4, Tools.LEFT_BOTTOM, Tools.RIGHT_BOTTOM, 5, 0);

		m_main_chengjiu.addControl(m_main_chengjiu1);
		m_main_chengjiu.addControl(m_main_chengjiu2);
		m_main_chengjiu.addControl(m_chengjiu_title);
		m_main_chengjiu.addControl(m_chengjiu_yaoqiu);
		m_main_chengjiu.addControl(m_chengjiu_yaoqiu1);
		m_main_chengjiu.addControl(m_main_chengjiu3);
		m_main_chengjiu.addControl(m_main_chengjiu4);
		m_main_chengjiu.addControl(m_chengjiu_ds);
		m_Uimain_Frame.addControl(m_main_chengjiu);
	}

	//		}
	//向下隐藏
	private DWListener m_xiayin = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (flag == false) {//
				m_MainImageBox[m_main_xiayincang].setBackground(m_MainBitmap[m_main_shangyinchang], true);
				m_main_sb01.setState(true);
				m_main_sb02.setState(true);
				m_num = 30;
				flag = true;
			}
			else {//+号
				m_MainImageBox[m_main_xiayincang].setBackground(m_MainBitmap[m_main_xiayincang], true);
				m_main_sb01.setState(false);
				m_main_sb02.setState(false);
				m_num = 0;
				flag = false;
			}
		}
	};
	//向上隐藏
	private DWListener m_shangyin = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (flag1 == false) {
				m_main_sb02.setState(true);
				flag1 = true;

			}
			else {
				m_main_sb02.setState(false);
				flag1 = false;

			}

		}
	};

	private final byte SMALLMAP_TYPE_GUAIWU = 0;//怪物
	private final byte SMALLMAP_TYPE_ZIJI = 1;//自己
	private final byte SMALLMAP_TYPE_TONGWAN = 2;//同阵营玩家
	private final byte SMALLMAP_TYPE_QIWAN = 3;//其他阵营玩家
	private final byte SMALLMAP_TYPE_CHUANSONG = 4;//传送门
	private final byte SMALLMAP_TYPE_TONGNPC = 5;//同阵营NPC
	private final byte SMALLMAP_TYPE_QINPC = 6;//其他阵营NPC
	private final byte SMALLMAP_TYPE_HUIWEN = 7;//灰色问号
	private final byte SMALLMAP_TYPE_HUANGTAN = 8;//黄色叹号
	private final byte SMALLMAP_TYPE_HUANGWEN = 9;//黄色问号
	private final byte SMALLMAP_TYPE_LANTAN = 10;//蓝色叹号
	private final byte SMALLMAP_TYPE_LANWEN = 11;//蓝色问号
	private final byte SMALLMAP_TYPE_ALL = 12;//总数
	private final String[] SMALLMAP_NAME = { "r_g", "y_z", "g_tzh", "r_qzh", "b_m", "y_tn", "y_qn", "g_q", "y_e",
			"y_q", "b_e", "b_q" };
	private Bitmap[] img_small_map = null;

	public void init()
	{
		m_tongji_bk = UIWindows.createImage("/img/newui/jiaoyimingzibeijing.gnp");

		m_bm_close = UIWindows.createImage("/img/newui/renwujiantou_1.gnp");
		m_MainBitmap[m_main_shangcheng] = IconManger.getInstance().getIcon(7);
		m_MainBitmap[m_main_yaoqianshu] = IconManger.getInstance().getIcon(8);
		m_MainBitmap[m_main_jitian] = IconManger.getInstance().getIcon(9);
		m_MainBitmap[m_main_lianhun] = IconManger.getInstance().getIcon(10);
		m_MainBitmap[m_main_gongfang] = IconManger.getInstance().getIcon(11);
		m_MainBitmap[m_main_liandan] = IconManger.getInstance().getIcon(12);;
		m_MainBitmap[m_main_gonglue] = IconManger.getInstance().getIcon(15);
		m_MainBitmap[m_main_youxirenwu] = IconManger.getInstance().getIcon(13);
		m_MainBitmap[m_main_fuben] = IconManger.getInstance().getIcon(14);
		m_MainBitmap[m_main_renwu] = UIWindows.createImage("/img/icon/big_datubiao_514.gnp");//IconManger.getInstance().getIcon(1);
		m_MainBitmap[m_main_beibao] = IconManger.getInstance().getIcon(2);
		m_MainBitmap[m_main_jiazu] = IconManger.getInstance().getIcon(3);
		m_MainBitmap[m_main_jineng] = IconManger.getInstance().getIcon(4);
		m_MainBitmap[m_main_shejiao] = IconManger.getInstance().getIcon(5);
		m_MainBitmap[m_main_shezhi] = IconManger.getInstance().getIcon(6);
		//灰色图标
		m_bm_yaoqianshu = UIWindows.createImage("/img/newui/big_black_8.gnp");
		m_bm_gongfang = UIWindows.createImage("/img/newui/big_black_11.gnp");
		m_bm_fuben = UIWindows.createImage("/img/newui/big_black_14.gnp");
		m_bm_paihang = UIWindows.createImage("/img/newui/big_black_15.gnp");
		m_bm_jitiantai = UIWindows.createImage("/img/newui/big_black_9.gnp");
		m_bm_liandan = UIWindows.createImage("/img/newui/big_black_12.gnp");
		m_bm_lianhun = UIWindows.createImage("/img/newui/big_black_10.gnp");

		m_MainBitmap[m_main_jineng01] = UIWindows.createImage("/img/newui/zhujiemianjnan_1.gnp");
		m_MainBitmap[m_main_jineng02] = UIWindows.createImage("/img/newui/zhujiemianjnan_2.gnp");
		m_MainBitmap[m_main_jineng03] = UIWindows.createImage("/img/newui/zhujiemianjnan_3.gnp");
		m_MainBitmap[m_main_chiyao] = UIWindows.createImage("/img/newui/zhujiemianjncy_1.gnp");
		m_MainBitmap[m_main_zuoqi] = UIWindows.createImage("/img/newui/zhujiemianjnzq_2.gnp");//坐骑图标(暗)
		m_bm_zuoqi = UIWindows.createImage("/img/newui/zhujiemianjnzq_1.gnp");//坐骑图标(亮)
		m_MainBitmap[m_main_zidong] = UIWindows.createImage("/img/newui/guaji_1.gnp");//自动打怪
		m_MainBitmap[m_main_zhurenwu] = UIWindows.createImage("/img/newui/zhujiemiantxk_1.gnp");//人物的头像框
		m_MainBitmap[m_main_duiwu01] = UIWindows.createImage("/img/newui/zhujiemiandytx_1.gnp");
		m_MainBitmap[m_main_duiwu02] = UIWindows.createImage("/img/newui/zhujiemiandytx_1.gnp");
		m_MainBitmap[m_main_duiwu03] = UIWindows.createImage("/img/newui/zhujiemiandytx_1.gnp");
		m_MainBitmap[m_main_youjian] = UIWindows.createImage("/img/newui/zhujiemianyj_1.gnp");//无新邮件图标
		m_bm_haveMail = UIWindows.createImage("/img/newui/zhujiemianyxyj_1.gnp");//有新邮件图标
		m_MainBitmap[m_main_yaogan01] = UIWindows.createImage("/img/newui/zhujiemianyg_1.gnp");
		m_MainBitmap[m_main_yaogan02] = UIWindows.createImage("/img/newui/zhujiemianyg_2.gnp");
		m_MainBitmap[m_main_xiayincang] = UIWindows.createImage("/img/newui/shousuo_2.gnp");//下隐藏
		m_MainBitmap[m_main_shangyinchang] = UIWindows.createImage("/img/newui/shousuo_1.gnp");//上齿轮
		m_MainBitmap[m_main_liaotiananniu] = UIWindows.createImage("/img/newui/zhujiemianltan_1.gnp");//聊天
		m_main_siliao = UIWindows.createImage("/img/newui/zhujiemianltan_2.gnp");//私聊
		m_MainBitmap[m_main_xiaoditu] = UIWindows.createImage("/img/newui/zhujiemiandt_1.gnp");//地图底图
		m_MainBitmap[m_main_dituxia] = UIWindows.createImage("/img/newui/renwujiantou_2.gnp"); //任务栏隐藏图标
		m_MainBitmap[m_main_nengliang] = UIWindows.createImage("/img/newui/zhujiemianxc_1.gnp");
		m_MainBitmap[m_main_xuetiao] = UIWindows.createImage("/img/newui/xuetiaoxia_1.gnp");// 自己血条底图
		m_MainBitmap[m_main_jingyan] = UIWindows.createImage("/img/newui/zhujiemianjdt_1.gnp");//经验条的底图
		m_bm_jingyantiao = UIWindows.createImage("/img/newui/zhujiemianjdt_2.gnp");//经验条上图
		m_MainBitmap[m_main_xianxue] = UIWindows.createImage("/img/newui/xuetiaoshang_1.gnp");//自己血 进度条
		m_MainBitmap[m_main_xianlan] = UIWindows.createImage("/img/newui/lvtiaoshang_1.gnp");// 自己怒气 进度条
		m_MainBitmap[m_main_xuanzhongxue] = UIWindows.createImage("/img/newui/zhujiemiangwxt_1.gnp");
		m_MainBitmap[m_main_duiwuxue01] = UIWindows.createImage("/img/newui/zhujiemiangwxt_1.gnp");
		m_MainBitmap[m_main_duiwuxue02] = UIWindows.createImage("/img/newui/zhujiemiangwxt_1.gnp");
		m_MainBitmap[m_main_duiwuxue03] = UIWindows.createImage("/img/newui/zhujiemiangwxt_1.gnp");
		m_MainBitmap[m_main_chongwu] = UIWindows.createImage("/img/newui/zhujiemiancwtb_2.gnp");//宠物图标（底图）
		m_bm_chongwu = UIWindows.createImage("/img/newui/chong_1.gnp");//宠物图标
		m_bm_near = UIWindows.createImage("/img/newui/wanjia_1.gnp");//附近玩家
		m_bm_huodong = UIWindows.createImage("/img/newui/xiaozhushou_1.gnp");//竞技(小)
		m_bm_fix = UIWindows.createImage("/img/newui/zhujiemianwpsh_1.gnp");//维修
		m_bm_lingjiang = UIWindows.createImage("/img/newui/lingjiang_1.gnp");//领奖(系统奖励)
		m_bm_banjiang = UIWindows.createImage("/img/icon/big_datubiao_346.gnp");//领奖
		m_bm_chengjiu = UIWindows.createImage("/img/newui/chengjiu_2.gnp");//成就
		//技能进度条（采集）
		m_skill_ditu = UIWindows.createImage("/img/newui/caijidt_2.gnp");
		m_skill_jindu = UIWindows.createImage("/img/newui/caijidt_1.gnp");
		//背景(xia)
		m_bm_middle = UIWindows.createImage("/img/newui/zhujiemianxttbk_1.gnp");
		m_bm_right = UIWindows.createImage("/img/newui/zhujiemianxttbk_2.gnp");
		m_bm_left = UIWindows.createImage("/img/newui/zhujiemianxttbk_3.gnp");
		//背景(shang)
		m_bm_middle_shang = UIWindows.createImage("/img/newui/zhujiemianxttbk_4.gnp");
		m_bm_right_shang = UIWindows.createImage("/img/newui/zhujiemianxttbk_5.gnp");
		m_bm_left_shang = UIWindows.createImage("/img/newui/zhujiemianxttbk_6.gnp");
		//被选中人物背景
		m_bm_checked = UIWindows.createImage("/img/newui/peijuemian_1.gnp");
		//右下图标底
		m_bm_tubiao = UIWindows.createImage("/img/newui/zhujiemiancy_1.gnp");
		m_bm_chiyaoditu = UIWindows.createImage("/img/newui/jimingtaijnk_3.gnp");
		m_bm_zuoqiditu = UIWindows.createImage("/img/newui/jimingtaijnk_2.gnp");
		// 蓝条
		m_bm_nuqishang = UIWindows.createImage("/img/newui/huangtiaoshang_1.gnp");
		m_bm_nuqixia = UIWindows.createImage("/img/newui/huangtiaoxia_1.gnp");
		//buff底图
		m_bm_buff = UIWindows.createImage("/img/newui/20x20kuangzi.gnp");
		//喊话
		m_bm_xitong = UIWindows.createImage("/img/newui/liaotiandsrks1.gnp");//gongyonghanhua_1
		m_bm_chicheng = UIWindows.createImage("/img/newui/chicheng_1.gnp");
		m_bm_chouhen = UIWindows.createImage("/img/newui/chouhen_1.gnp");
		m_bm_fennu = UIWindows.createImage("/img/newui/fennu_1.gnp");
		m_bm_ganji = UIWindows.createImage("/img/newui/ganji_1.gnp");

		//拾取
		m_bm_pickup = IconManger.getInstance().getIcon(261);
		// 主人物头像
		m_zhurenwu_jiannan = UIWindows.createImage("/img/newui/bigtx_nan_jianke.gnp");
		m_zhurenwu_wunan = UIWindows.createImage("/img/newui/bigtx_nan_daoke.gnp");
		m_zhurenwu_daonan = UIWindows.createImage("/img/newui/bigtx_nan_fashi.gnp");
		m_zhurenwu_jiannv = UIWindows.createImage("/img/newui/bigtx_nv_jianke.gnp");
		m_zhurenwu_wunv = UIWindows.createImage("/img/newui/bigtx_nv_daoke.gnp");
		m_zhurenwu_daonv = UIWindows.createImage("/img/newui/bigtx_nv_fashi.gnp");
		//队伍头像
		m_team_jiannan = UIWindows.createImage("/img/newui/smalltx_nan_jianke.gnp");
		m_team_wunan = UIWindows.createImage("/img/newui/smalltx_nan_daoke.gnp");
		m_team_daonan = UIWindows.createImage("/img/newui/smalltx_nan_fashi.gnp");
		m_team_jiannv = UIWindows.createImage("/img/newui/smalltx_nv_jianke.gnp");
		m_team_wunv = UIWindows.createImage("/img/newui/smalltx_nv_daoke.gnp");
		m_team_daonv = UIWindows.createImage("/img/newui/smalltx_nv_fashi.gnp");
		//小地图名
		m_bm_location = UIWindows.createImage("/img/newui/zhujiemiandt_2.gnp");
		//小地图
		img_small_map = new Bitmap[SMALLMAP_TYPE_ALL];
		for (int i = 0; i < SMALLMAP_TYPE_ALL; i++) {
			img_small_map[i] = UIWindows.createImage("/img/newui/th_" + SMALLMAP_NAME[i] + ".gnp");
		}
		//大招
		Animation anim_1 = UIWindows.createAnimation("/anim/juejiui_00.anim");
		m_actor_dazhao_head = new Actor(anim_1);
		Animation anim_2 = UIWindows.createAnimation("/anim/juejiui_01.anim");
		m_actor_dazhao_center = new Actor(anim_2);
		//6个喊话动画
		Animation chicheng = UIWindows.createAnimation("/anim/chicheng.anim");
		m_actor_chicheng = new Actor(chicheng);
		Animation fennu = UIWindows.createAnimation("/anim/fennu.anim");
		m_actor_fennu = new Actor(fennu);
		Animation chouhenleft = UIWindows.createAnimation("/anim/chouhen.anim");
		m_actor_chouhenleft = new Actor(chouhenleft);
		Animation chouhenright = UIWindows.createAnimation("/anim/chouhen.anim");
		m_actor_chouhenright = new Actor(chouhenright);
		Animation ganji = UIWindows.createAnimation("/anim/ganji.anim");
		m_actor_ganji = new Actor(ganji);
		Animation ganji1 = UIWindows.createAnimation("/anim/ganji_1.anim");
		m_actor_ganji1 = new Actor(ganji1);

		m_main_chengjiuimg = UIWindows.createImage("/img/newui/chengjiubj_1.gnp");
		m_main_chengjiudianshu = UIWindows.createImage("/img/newui/chengjiu_3.gnp");
		m_main_chengjiuname = UIWindows.createImage("/img/newui/chengjiudacheng_1.gnp");
		m_main_chengjiubk = UIWindows.createImage("/img/newui/dachengchengjiudi_1.gnp");

		m_tishi_Bitmap = UIWindows.createImage("/img/newui/xuanzekuang_3.gnp");//小任务提示区背景
		Animation renwu = UIWindows.createAnimation("/anim/renwutsdh_1.anim");
		m_task_Actor = new Actor(renwu);
	}

	public void open(byte index)
	{
		if (index == 0) {
			uiMainPut();
			Tools.debugPrintln("开启主界面");
		}
		else if (index == 1) {
			horn();
		}
		else if (index == 2) {
			systemHorn();
		}
		else if (index == 3) {
			marriageHorn();
		}

	}

	public void close(byte index)
	{
		if (index == 0) {
			DWControlsManager.getInstance().removeControl(m_Uimain_Frame);
		}
		else if (index == 1) {
			DWControlsManager.getInstance().removeControl(m_horn_frame);
		}

	}

	public void dispose()
	{
		m_Uimain_Frame = null;
//		UIWindows.getInstance().m_taskTips.close((byte)0);
	}

	/*
	 * 喇叭的frame
	 */
	private DWFrame m_horn_frame = null;

	public void horn()
	{
		m_horn_frame = new DWFrame();
		m_horn_frame.setShowWideHigh(700, 100);
//		m_horn_frame.setShow(true);
//		m_horn_frame.set
		m_horn_frame.setThrough(true);
		m_horn_frame.setTouch(false);
		m_horn_frame.setShield(true);
		m_horn_frame.setClickClose(false);
		m_horn_frame.setTop(true);
		m_horn_frame.setNearAnchor(m_UiTitle, Tools.HCENTER_TOP, Tools.HCENTER_VCENTER, 0, 100);

		//各种喊话

		m_imageBox_hanhua = new DWImageBox(m_bm_chouhen);//m_bm_chicheng  m_bm_fennu m_bm_ganji m_bm_chouhen
//		m_imageBox_hanhua.setPoint(DWGameManager.Screen_Width * 3 / 10, 80);//
		//	m_imageBox_hanhua.setShow(false);
		m_imageBox_hanhua.setTouch(false);
		m_imageBox_hanhua.setTop(true);
		m_imageBox_hanhua.setNearAnchor(m_horn_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, -20);
		m_horn_frame.addControl(m_imageBox_hanhua);

		m_tabPage_hanhua = new DWTabPage();
//		m_tabPage_hanhua.setSelect(true);
		m_tabPage_hanhua.setSelect(true);
		m_tabPage_hanhua.setTouch(false);
		m_tabPage_hanhua.setTop(true);
//		m_tabPage_hanhua.setPoint(DWGameManager.Screen_Width * 3 / 10 + 30, 100);//差30
		if (DWGameManager.AdpaterType == 2) {
			m_tabPage_hanhua.setShowWideHigh(620, 50);
		}
		else {
			m_tabPage_hanhua.setShowWideHigh(420, 50);
		}
		m_tabPage_hanhua.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 18);
//
//
		m_textBox_hanhua = new DWTextbox("");
		m_tabPage_hanhua.addControls(m_textBox_hanhua);
		m_textBox_hanhua.setPoint(420, 0);
//
		m_horn_frame.addControl(m_tabPage_hanhua);

		//喊话的六个动画位置
		m_ab_chicheng = new DWAnimationBox(m_actor_chicheng);
		m_ab_fennu = new DWAnimationBox(m_actor_fennu);
		m_ab_chouhenleft = new DWAnimationBox(m_actor_chouhenleft);
		m_ab_chouhenright = new DWAnimationBox(m_actor_chouhenright);
		m_ab_ganji = new DWAnimationBox(m_actor_ganji);
		m_ab_ganji1 = new DWAnimationBox(m_actor_ganji1);

		m_ab_chicheng.setShow(false);
		m_ab_fennu.setShow(false);
		m_ab_chouhenleft.setShow(false);
		m_ab_chouhenright.setShow(false);//改成愤怒了
		m_ab_ganji.setShow(false);
		m_ab_ganji1.setShow(false);

		m_ab_chicheng.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_BOTTOM, Tools.HCENTER_BOTTOM, 0, 0);
		m_ab_fennu.setNearAnchor(m_imageBox_hanhua, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, 0, -30);
		m_ab_chouhenleft.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_BOTTOM, Tools.LEFT_BOTTOM, 0, 0);
		m_ab_chouhenright.setNearAnchor(m_imageBox_hanhua, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, 0, -30);
		m_ab_ganji.setNearAnchor(m_imageBox_hanhua, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, 0, -40);
		m_ab_ganji1.setNearAnchor(m_ab_ganji, Tools.HCENTER_BOTTOM, Tools.LEFT_TOP, 0, -40);

		m_horn_frame.addControl(m_ab_chicheng);
		m_horn_frame.addControl(m_ab_fennu);
		m_horn_frame.addControl(m_ab_chouhenleft);
		m_horn_frame.addControl(m_ab_chouhenright);
		m_horn_frame.addControl(m_ab_ganji);
		m_horn_frame.addControl(m_ab_ganji1);

//		DWControlsManager.getInstance().addControl(m_horn_frame);
	}

	/*
	 * 喇叭的frame
	 */
	private DWFrame m_system_frame = null;
	private DWImageBox m_system_imageBox = null;
	private DWTabPage m_system_tabPage = null;
	private DWTextbox m_system_textBox = null;

	public void systemHorn()
	{
		m_system_frame = new DWFrame();
		m_system_frame.setShowWideHigh(700, 100);
//		m_horn_frame.setShow(true);
		m_system_frame.setThrough(true);
		m_system_frame.setTouch(false);
		m_system_frame.setShield(true);
		m_system_frame.setClickClose(false);
		m_system_frame.setTop(true);
		m_system_frame.setNearAnchor(m_UiTitle, Tools.HCENTER_TOP, Tools.HCENTER_VCENTER, 0, 200);

		//系统喊话

		m_system_imageBox = new DWImageBox(m_bm_xitong);
//		m_imageBox_hanhua.setPoint(DWGameManager.Screen_Width * 3 / 10, 80);//
		//	m_imageBox_hanhua.setShow(false);
		m_system_imageBox.setTouch(false);
		m_system_imageBox.setTop(true);
		m_system_imageBox.setNearAnchor(m_system_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, -20);
		m_system_frame.addControl(m_system_imageBox);

		m_system_tabPage = new DWTabPage();
//		m_tabPage_hanhua.setSelect(true);
		m_system_tabPage.setSelect(true);
		m_system_tabPage.setTouch(false);
		m_system_tabPage.setTop(true);
//		m_tabPage_hanhua.setPoint(DWGameManager.Screen_Width * 3 / 10 + 30, 100);//差30
		m_system_tabPage.setShowWideHigh(600, 50);
		m_system_tabPage.setNearAnchor(m_system_imageBox, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 15);

		m_system_textBox = new DWTextbox("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
		m_system_tabPage.addControls(m_system_textBox);
		m_system_textBox.setPoint(600, 0);
		m_system_frame.addControl(m_system_tabPage);
//		DWControlsManager.getInstance().addControl(m_system_frame);
	}

	/**
	 * 带粒子动画的喊话
	 */
	private DWFrame m_particle_frame = null;
	private DWImageBox m_particle_imageBox = null;
	private DWTabPage m_particle_tabPage = null;
	private DWTextbox m_particle_textBox = null;
	private float m_particle_x = 0;

	public void marriageHorn()
	{
		m_particle_frame = new DWFrame();
		m_particle_frame.setShowWideHigh(700, 100);
		m_particle_frame.setThrough(true);
		m_particle_frame.setTouch(false);
		m_particle_frame.setShield(true);
		m_particle_frame.setClickClose(false);
		m_particle_frame.setTop(true);
		m_particle_frame.setNearAnchor(m_UiTitle, Tools.HCENTER_TOP, Tools.HCENTER_VCENTER, 0, 150);

		//结婚

		m_particle_imageBox = new DWImageBox(m_bm_xitong);
		m_particle_imageBox.setTouch(false);
		m_particle_imageBox.setNearAnchor(m_particle_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, -20);
		m_particle_frame.addControl(m_particle_imageBox);

		m_particle_tabPage = new DWTabPage();
		m_particle_tabPage.setSelect(true);
		m_particle_tabPage.setTouch(false);
		m_particle_tabPage.setShowWideHigh(600, 50);
		m_particle_tabPage.setNearAnchor(m_particle_imageBox, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 15);

		m_particle_textBox = new DWTextbox("");
		m_particle_tabPage.addControls(m_particle_textBox);
		m_particle_textBox.setPoint(600, 0);
		m_particle_frame.addControl(m_particle_imageBox);
		m_particle_frame.addControl(m_particle_tabPage);

//		DWControlsManager.getInstance().addControl(m_particle_frame);
	}

	long m_begin_time = 0;
	long m_next_time = 0;

	/**
	 * 婚姻的读秒刷新
	 */
	public void marriageRefreshTime()
	{
//		if (m_begin_time == 0) {
//			m_begin_time = System.currentTimeMillis();///开始倒计时时截取系统时间
//			m_next_time = m_begin_time + 1000;
//		}
//		long m_currrent_time = System.currentTimeMillis();
//		if (m_currrent_time >= m_next_time) {
		updateParticleNotice();
//			m_begin_time = m_next_time;
//			m_next_time += 1000;
//		}
	}

	/**
	 * 刷新公告
	 */
	public void updateParticleNotice()
	{
		//喊话w
		ArrayList<String> m_hanhua = DWGameManager.getInstance().m_particle_message;
		//逻辑
		if (m_hanhua != null && m_hanhua.size() > 0) {
			String m_system_str = (String) m_hanhua.get(0);
			int m_type = Integer.parseInt(m_system_str.substring(0, 2));
			if (!DWControlsManager.getInstance().contains(m_particle_frame)) {
				switch (m_type) {
					case ParticleConstants.动画组_元宝雨_右:
						DWGameManager.getInstance().m_role.m_scene.startParticle(ParticleConstants.动画组_元宝雨_右,
								ParticleConstants.轨迹_右斜线);
						break;
					case ParticleConstants.动画组_花瓣雨:
						DWGameManager.getInstance().m_role.m_scene.startParticle(ParticleConstants.类型_花瓣,
								ParticleConstants.轨迹_花瓣);
						break;
					case ParticleConstants.动画组_结婚:
						m_particle_tabPage.setNearAnchor(m_particle_imageBox, Tools.HCENTER_VCENTER,
								Tools.HCENTER_VCENTER, 0,
								15);
						DWGameManager.getInstance().m_role.m_scene.startParticle(ParticleConstants.动画组_结婚, 0);
						break;
					default:
						return;
				}
				m_particle_textBox.setText(m_system_str.substring(2));
				m_particle_textBox.setPoint(600, 0);
				DWControlsManager.getInstance().addControl(m_particle_frame);
			}
			else {
				if ((600 + m_particle_textBox.getShowWidth()) >= m_particle_x) {
					float per = (float) (DWGameManager.FRAME_PER_SECOND * 15);
					float time = (float) (600 + m_particle_textBox.getShowWidth()) / (float) per;//15秒结束（刷新以秒计算）
					m_particle_x += time;
					int step = (int) m_particle_x;
					m_particle_textBox.setPoint(600 - step, 0);
				}
				else {
					switch (m_type) {
						case ParticleConstants.动画组_元宝雨_右:
							DWGameManager.getInstance().m_role.m_scene.closeParticle(ParticleConstants.动画组_元宝雨_右);
							break;
						case ParticleConstants.动画组_花瓣雨:
							DWGameManager.getInstance().m_role.m_scene.closeParticle(ParticleConstants.类型_花瓣);
							break;
						case ParticleConstants.动画组_结婚:
							DWGameManager.getInstance().m_role.m_scene.closeParticle(ParticleConstants.动画组_结婚);
							break;
						default:
							return;
					}
					m_particle_textBox.setText(null);
					DWControlsManager.getInstance().removeControl(m_particle_frame);
					m_particle_x = 0;
					m_hanhua.remove(0);
				}
			}
		}

	}

	public final int SCENE_SCOPE = DWGameManager.Screen_Width;//同屏范围
	public int SMALL_MAP_W = 0;//小地图宽度
	public int SMALL_MAP_H = 0;//小地图高度
	public int SMALL_MAP_X = 0;
	public int SMALL_MAP_Y = 0;
	public float SCALED_DOWN_X = 0;//缩小比例x
	public float SCALED_DOWN_Y = 0;//缩小比例y
	public DWExternalDraw m_small_map = new DWExternalDraw() {
		public void externalDraw(DWGraphics g, int x, int y)
		{
			IGameHandler gameHandler = DWGameManager.getInstance().getGameHandler();
			if (gameHandler instanceof SceneHandler) {
				SceneHandler sceneHandler = (SceneHandler) gameHandler;
				if (sceneHandler != null && sceneHandler.m_scene != null) {
					g.setClip(SMALL_MAP_X, SMALL_MAP_Y, SMALL_MAP_W, SMALL_MAP_H);
					Object[] dyAc = sceneHandler.m_scene.m_dynamicActors.values().toArray();
					for (int i = 0, index = 0; i < dyAc.length; i++) {
						GameActor gameActor = (GameActor) dyAc[i];
						index = SMALLMAP_TYPE_GUAIWU;
						if (gameActor != null && gameActor.m_enabled) {
							switch (gameActor.m_type) {
								case GameActorConstants.ACTOR_TYPE_MONSTER:
									index = SMALLMAP_TYPE_GUAIWU;
									break;
								case GameActorConstants.ACTOR_TYPE_GATE:
									index = SMALLMAP_TYPE_CHUANSONG;
									break;
								case GameActorConstants.ACTOR_TYPE_NPC:
									if (DWGameManager.getInstance().m_role.checkTargetFriend(gameActor)) {
										if (gameActor.m_head_state == Npc.HEAD_STATE_YELLOW_QUESTION_MARK) {
											index = SMALLMAP_TYPE_HUANGWEN;
										}
										else if (gameActor.m_head_state == Npc.HEAD_STATE_BLUE_QUESTION_MARK) {
											index = SMALLMAP_TYPE_LANWEN;
										}
										else if (gameActor.m_head_state == Npc.HEAD_STATE_YELLOW_EXCLAMATION_MARK) {
											index = SMALLMAP_TYPE_HUANGTAN;
										}
										else if (gameActor.m_head_state == Npc.HEAD_STATE_BLUE_EXCLAMATION_MARK) {
											index = SMALLMAP_TYPE_LANTAN;
										}
										else if (gameActor.m_head_state == Npc.HEAD_STATE_GRAY_QUESTION_MARK) {
											index = SMALLMAP_TYPE_HUIWEN;
										}
										else {
											index = SMALLMAP_TYPE_TONGNPC;
										}
									}
									else {
										index = SMALLMAP_TYPE_QINPC;
									}
									break;
								case GameActorConstants.ACTOR_TYPE_ROLE:
									if (DWGameManager.getInstance().m_role.m_gameId == gameActor.m_gameId) {
										index = SMALLMAP_TYPE_ZIJI;
									}
									else if (DWGameManager.getInstance().m_role.checkTargetFriend(gameActor)) {
										index = SMALLMAP_TYPE_TONGWAN;
									}
									else {
										index = SMALLMAP_TYPE_QIWAN;
									}
									break;
								default:
									index = SMALLMAP_TYPE_GUAIWU;
									break;
							}
						}
						float cx = (gameActor.m_posX - sceneHandler.m_scene.m_cameraX) * SCALED_DOWN_X;
						float cy = (gameActor.m_posY - sceneHandler.m_scene.m_cameraY) * SCALED_DOWN_Y;
						if (pointOnEllipse(cx - SMALL_MAP_W / 2 - 3, cy - SMALL_MAP_H / 2 - 3, SMALL_MAP_W / 2 - 3,
								SMALL_MAP_H / 2 - 3)) {
							if (index > -1 && img_small_map != null && index >= 0 && index < img_small_map.length) {
								g.drawBitmap(img_small_map[index], x
										+ (gameActor.m_posX - sceneHandler.m_scene.m_cameraX) * SCALED_DOWN_X,
										y + (gameActor.m_posY - sceneHandler.m_scene.m_cameraY) * SCALED_DOWN_Y,
										Tools.HCENTER_VCENTER);
							}
						}
					}
				}
			}
		}
	};

	/**
	 * x,y是否在半径radius_x, radius_y范围内
	 * @param x
	 * @param y
	 * @param radius_x
	 * @param radius_y
	 * @return
	 */
	private boolean pointOnEllipse(float x, float y, float radius_x, float radius_y)
	{
		if ((Math.pow(x, 2) / Math.pow(radius_x, 2) + Math.pow(y, 2) / Math.pow(radius_y, 2)) < 1) {
			return true;
		}
		return false;
	}

	public void setFlag()
	{

	}

	/**
	 * 移除技能读条
	 */
	public void removeBar()
	{
		m_skill_flag = false;
		UIMap.m_is_transit = false;
		UISocial.m_shitu_isOpen = false;
		m_pBar_skill.setShow(false);
		m_text_skill.setShow(false);
	}

	/**
	 * 设置 进度条的 当前值和总值 和 名字
	 * @param str 名字
	 * @param total 总值
	 */
	public void setBarTotal(String str, int total)
	{
		m_pBar_skill.setShow(true);
		m_text_skill.setShow(true);

		m_curr = 0;
		if (str != null && total > 0) {
			m_text_skill.setName(str);
			m_text_skill.setNearAnchor(m_pBar_skill, Tools.HCENTER_TOP, Tools.HCENTER_TOP, 0, -20);
			m_total = total;
			m_skill_flag = true;
		}
		else {
			return;
		}
	}

	//
	/**
	 *
	 * @param obj 技能对象
	 * @param time 不点击，多久失效（点击图标消失）
	 */
	public void bigSkill(int time)
	{
//		IShortcutObject obj = DWGameManager.getInstance().m_role.getShortcutObject(Role.SHORTCUT_SKILL3);
//		obj.doShortcutAction(role);
		if (m_main_roleskill[3] == null) {
			return;
		}
		m_valib_time = time;
		m_animBox_dazhao_head.setShow(true);
		m_animBox_dazhao_center.setShow(true);
		m_grid_dazhao.addObject(m_main_roleskill[3]);
		m_grid_dazhao.setShow(true);
		m_grid_dazhao.setTouch(true);
	}

	public void removeBigSkill()
	{
		m_valib_time = 0;
		m_animBox_dazhao_head.setShow(false);
		m_animBox_dazhao_center.setShow(false);
		m_grid_dazhao.setShow(false);
		m_grid_dazhao.setTouch(false);
	}

	private DWListener m_dazhao = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (DWGameManager.getInstance().m_role.isSellStatus()) {
				DWGameManager.getInstance().addSystemInfo(
						DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
				return;
			}
			if (role != null) {
				if (m_main_roleskill[3] != null) {
					DWGameManager.getInstance().m_role.clearAutoAttack();
					IShortcutObject obj = DWGameManager.getInstance().m_role.getShortcutObject(Role.SHORTCUT_SKILL3);
					if (obj.doShortcutAction(role)) {
						removeBigSkill();
						//TODO CUTIN
						role.m_scene.startCutin(role.m_vocation, role.m_sex);
					}
					else {
						Tools.debugPrintln("施放绝技失败！！！");
					}
					UIHook.closeHook();
				}
				else {
					return;
				}
			}
			else {
				return;
			}

		}
	};

	/**
	 * 添加技能对象，以及位置（0-2）
	 * @param object
	 * @param index
	 */
	public void addGridAgain(Object object, int index)
	{
		m_grid_dizi[index].removeObject();
		m_grid_dizi[index].addObject(object);
	}

	////任务提示区
	public DWListSubItem[] m_ttLSItem;
	public DWImageBox[] m_LSItem_beijing;
	public boolean m_isOne = true;
	public Task m_task;//全局任务
	public Actor m_task_Actor = null;
	public boolean m_task_type = true;//是否播放动画
	Bitmap m_tishi_Bitmap = null;//小任务提示区背景
	public DWAnimationBox m_animBox_renwu = null;
	public long m_task_time = 0;

	public void refreshTask()
	{
		//任务提示区
		if (m_task_listBox != null) {
			m_task_listBox.removeAllSubItem();
			if (DWGameManager.getInstance().m_role.m_drama_list.size() >= 1) {
				m_ttLSItem = new DWListSubItem[DWGameManager.getInstance().m_role.m_drama_list.size()];
				m_LSItem_beijing = new DWImageBox[DWGameManager.getInstance().m_role.m_drama_list.size()];
				DWTextbox[] m_ttTextbox01 = new DWTextbox[DWGameManager.getInstance().m_role.m_drama_list.size()];
				for (int i = 0; i < DWGameManager.getInstance().m_role.m_drama_list.size(); i++) {
					final int index = i;
					Task task = DWGameManager.getInstance().m_role.m_drama_list.get(i);
					m_ttLSItem[i] = new DWListSubItem();

//					m_task_listBox.addListener(m_task_tiem);
					if (task.m_progress == null) {
						task.m_progress = "";
					}
					m_ttTextbox01[i] = new DWTextbox(
							"<mark c=00BFFF>"
									+ task.m_name
									+ "</mark>"
									+ "<mark c=" + task.TASK_NAME_COLOR_STR[task.m_status] + ">"
									+ task.TASK_STATUS[task.m_status] + "</mark>`"
									+ task.m_progress
							, m_task_background.getShowWidth());
					if (DWGameManager.AdpaterType == 2) {
						m_ttTextbox01[i].setFont(DWFont.getFont(24));
					}
					else {
						m_ttTextbox01[i].setFont(DWFont.getFont(20));
					}
					m_ttTextbox01[i].setNearAnchor(m_ttLSItem[i], Tools.LEFT_TOP, Tools.LEFT_TOP);

					m_LSItem_beijing[i] = new DWImageBox(m_tishi_Bitmap);
					m_LSItem_beijing[i].setNearAnchor(m_ttTextbox01[i], Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER);
					m_LSItem_beijing[i].setShowWideHighUn(m_ttTextbox01[i].getShowWidth(), m_ttTextbox01[i]
							.getShowHeight());
					m_LSItem_beijing[i].setTouch(false);
					m_LSItem_beijing[i].setShow(false);

					m_ttLSItem[i].addControls(m_LSItem_beijing[i]);
					m_ttLSItem[i].addControls(m_ttTextbox01[i]);
					m_task_listBox.addSubItem(m_ttLSItem[i]);

					if (DWGameManager.getInstance().m_role.m_drama_list.size() == 1) {
						//整个区域、
						m_task_back.setTouch(true);
						m_task_back.addListener(new DWListener() {

							public void OnDoubleClick()
							{

							}

							public void OnClick()
							{
								if (DWGameManager.getInstance().m_role.isSellStatus()) {
									DWGameManager.getInstance().addSystemInfo(
											DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
									return;
								}
								if (DWGameManager.getInstance().m_role.m_drama_list.size() == 1) {
									m_task_listBox.setGuide(false);
									UIHook.closeHook();
									DWGameManager.getInstance().m_role.breakAutoAttack();
									Task task = DWGameManager.getInstance().m_role.m_drama_list.get(0);
									m_task = task;
									DWGameManager.getInstance().getSendMessage().sendScenePathfinding(task.m_key);
									for (int j = 0; j < m_LSItem_beijing.length; j++) {
										m_LSItem_beijing[j].setShow(false);
									}
									m_LSItem_beijing[index].setShow(true);
									m_animBox_renwu.setShow(false);
									m_task_type = false;
								}
							}
						});
					}
					else {
						m_task_back.setTouch(false);
						m_ttTextbox01[index].addListener(new DWListener() {

							public void OnDoubleClick()
							{

							}

							public void OnClick()
							{
								if (DWGameManager.getInstance().m_role.isSellStatus()) {
									DWGameManager.getInstance().addSystemInfo(
											DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
									return;
								}
								if (DWGameManager.getInstance().m_role.m_drama_list.size() >= 1) {
									UIHook.closeHook();
									DWGameManager.getInstance().m_role.breakAutoAttack();
									Task task = DWGameManager.getInstance().m_role.m_drama_list.get(index);
									m_task = task;
									DWGameManager.getInstance().getSendMessage().sendScenePathfinding(task.m_key);
									for (int j = 0; j < m_LSItem_beijing.length; j++) {
										m_LSItem_beijing[j].setShow(false);
									}
									m_LSItem_beijing[index].setShow(true);
									m_animBox_renwu.setShow(false);
									m_task_type = false;
								}
							}
						});
					}
				}
			}
			else if (DWGameManager.getInstance().m_role.m_acceptably_list != null
					&& DWGameManager.getInstance().m_role.m_drama_list.size() < 1) {
				m_ttLSItem = new DWListSubItem[DWGameManager.getInstance().m_role.m_acceptably_list.size()];
				m_LSItem_beijing = new DWImageBox[DWGameManager.getInstance().m_role.m_acceptably_list.size()];
				DWTextbox[] m_ttTextbox01 = new DWTextbox[DWGameManager.getInstance().m_role.m_acceptably_list.size()];
				for (int i = 0; i < DWGameManager.getInstance().m_role.m_acceptably_list.size(); i++) {
					final int index = i;
					Task task = DWGameManager.getInstance().m_role.m_acceptably_list.get(i);
					m_ttLSItem[i] = new DWListSubItem();

//					m_task_listBox.addListener(m_task_tiem);
					if (task.m_progress == null) {
						task.m_progress = "";
					}
					m_ttTextbox01[i] = new DWTextbox(
							"<mark c=00BFFF>"
									+ task.m_name
									+ "</mark>"
									+ "<mark c=FF0000>" + task.TASK_STATUS[task.m_status] + "</mark>`"
									+ task.m_progress
							, m_task_background.getShowWidth());
					if (DWGameManager.AdpaterType == 2) {
						m_ttTextbox01[i].setFont(DWFont.getFont(24));
					}
					else {
						m_ttTextbox01[i].setFont(DWFont.getFont(20));
					}
					m_ttTextbox01[i].setNearAnchor(m_ttLSItem[i], Tools.LEFT_TOP, Tools.LEFT_TOP);

					m_LSItem_beijing[i] = new DWImageBox(m_tishi_Bitmap);
					m_LSItem_beijing[i].setNearAnchor(m_ttTextbox01[i], Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER);
					m_LSItem_beijing[i].setShowWideHighUn(m_ttTextbox01[i].getShowWidth(), m_ttTextbox01[i]
							.getShowHeight());
					m_LSItem_beijing[i].setTouch(false);
					m_LSItem_beijing[i].setShow(false);

					m_ttLSItem[i].addControls(m_LSItem_beijing[i]);
					m_ttLSItem[i].addControls(m_ttTextbox01[i]);
					m_task_listBox.addSubItem(m_ttLSItem[i]);

					if (DWGameManager.getInstance().m_role.m_acceptably_list.size() == 1) {
						m_task_back.setTouch(true);
						m_task_back.addListener(new DWListener() {

							public void OnDoubleClick()
							{

							}

							public void OnClick()
							{
								if (DWGameManager.getInstance().m_role.isSellStatus()) {
									DWGameManager.getInstance().addSystemInfo(
											DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
									return;
								}
								if (DWGameManager.getInstance().m_role.m_acceptably_list.size() == 1) {
									UIHook.closeHook();
									m_task_listBox.setGuide(false);
									DWGameManager.getInstance().m_role.breakAutoAttack();
									Task task1 = DWGameManager.getInstance().m_role.m_acceptably_list.get(index);
									m_task = task1;
									DWGameManager.getInstance().getSendMessage().sendScenePathfinding(task1.m_key);
									for (int j = 0; j < m_LSItem_beijing.length; j++) {
										m_LSItem_beijing[j].setShow(false);
									}
									m_LSItem_beijing[index].setShow(true);
									m_animBox_renwu.setShow(false);
									m_task_type = false;
								}
							}
						});
					}
					else {
						m_task_back.setTouch(false);
						m_ttTextbox01[index].addListener(new DWListener() {

							public void OnDoubleClick()
							{

							}

							public void OnClick()
							{
								if (DWGameManager.getInstance().m_role.isSellStatus()) {
									DWGameManager.getInstance().addSystemInfo(
											DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
									return;
								}
								if (DWGameManager.getInstance().m_role.m_acceptably_list.size() >= 1) {
									UIHook.closeHook();
									DWGameManager.getInstance().m_role.breakAutoAttack();
									Task task1 = DWGameManager.getInstance().m_role.m_acceptably_list.get(index);
									m_task = task1;
									DWGameManager.getInstance().getSendMessage().sendScenePathfinding(task1.m_key);
									for (int j = 0; j < m_LSItem_beijing.length; j++) {
										m_LSItem_beijing[j].setShow(false);
									}
									m_LSItem_beijing[index].setShow(true);
									m_animBox_renwu.setShow(false);
									m_task_type = false;
								}
							}
						});
					}
				}
			}
		}
	}

	//提供第一个sub
	public DWControl getSubItem()
	{

		if (m_ttLSItem == null) {
			return null;
		}
		if (m_ttLSItem[0] == null) {
			return null;
		}

		return m_ttLSItem[0];

	}

	//刷新一下任务框（防止不是最上层被覆盖）
	private void refreshBackGround()
	{
		m_Uimain_Frame.removeControl(m_task_background);
		m_Uimain_Frame.removeControl(m_task_listBox);
		m_Uimain_Frame.removeControl(m_task_back);
		m_Uimain_Frame.removeControl(m_task_close);
		m_Uimain_Frame.addControl(m_task_background);
		m_Uimain_Frame.addControl(m_task_listBox);
		m_Uimain_Frame.addControl(m_task_back);
		m_Uimain_Frame.addControl(m_task_close);
	}

	//任务提示区 关闭按钮监听
	private DWListener m_close = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (DWGameManager.getInstance().m_role.isSellStatus()) {
				DWGameManager.getInstance().addSystemInfo(
						DWGameManager.SYSTEM_INFO_TYPE_B, "摆摊中，无法操作！");
				return;
			}
			m_Uimain_Frame.addControl(m_renwuanniu);
			m_Uimain_Frame.removeControl(m_task_background);
			m_Uimain_Frame.removeControl(m_task_listBox);
			m_Uimain_Frame.removeControl(m_task_back);
			m_Uimain_Frame.removeControl(m_task_close);
			m_flag = true;
		}
	};

	//任务提示区开启方法
	public void OpenTaskList()
	{
		if (m_flag == false) {
			return;
		}
		else {
			m_Uimain_Frame.removeControl(m_renwuanniu);
			m_Uimain_Frame.addControl(m_task_background);
			m_Uimain_Frame.addControl(m_task_listBox);
			m_Uimain_Frame.addControl(m_task_back);
			m_Uimain_Frame.addControl(m_task_close);
			m_flag = false;
		}
	}

	//任务窗口收回
	public void closeTaskList()
	{
		if (m_flag == false) {//开启状态
			m_Uimain_Frame.addControl(m_renwuanniu);
			m_Uimain_Frame.removeControl(m_task_background);
			m_Uimain_Frame.removeControl(m_task_listBox);
			m_Uimain_Frame.removeControl(m_task_back);
			m_Uimain_Frame.removeControl(m_task_close);
			m_flag = true;
		}
		else {
			return;
		}
	}

	//任务栏的隐藏
	public void hideTaskList()
	{
		if (m_flag == false) {//开启
			m_task_background.setShow(false);
			m_task_listBox.setShow(false);
			m_task_close.setShow(false);

			m_task_background.setTouch(false);
			m_task_listBox.setTouch(false);
			m_task_close.setTouch(false);
		}
		else {
			m_renwuanniu.setShow(false);
			m_renwuanniu.setTouch(false);
		}
	}

	//任务栏的显示\
	public void showTaskList()
	{
		if (m_flag == false) {//开启状态
			m_task_background.setShow(true);
			m_task_listBox.setShow(true);
			m_task_close.setShow(true);

			m_task_background.setTouch(true);
			m_task_listBox.setTouch(true);
			m_task_close.setTouch(true);
		}
		else {
			m_renwuanniu.setShow(true);
			m_renwuanniu.setTouch(true);
		}
	}

	//队伍列表
	private void teamList()
	{
		role = DWGameManager.getInstance().m_role;
		Vector<Role> m_team = role.m_roleTeam;
		int m_index_change = 0;
		if (m_team != null) {
			Tools.debugPrintln("m_team.size:" + m_team.size());
			if (m_team.size() != 0) {
				for (int j = 0; j < 3; j++) {
					m_main_team[j].setShow(false);
					m_text_team[j].setName("");
					m_text_team[j].setShow(false);
					m_pbar_team[j].setShow(false);
					m_iamgeBox_team[j].setShow(false);
				}
				m_MainImageBox[m_main_youjian].setNearAnchor(
						m_imageBox_huodong, Tools.LEFT_TOP,
						Tools.LEFT_BOTTOM, 0, 10);
				m_imageBox_fix.setNearAnchorUn(m_MainImageBox[m_main_youjian], Tools.LEFT_VCENTER,
						Tools.RIGHT_VCENTER, 10, 0);
				for (int i = 0; i < m_team.size(); i++) {
					Role m_team_role = (Role) m_team.elementAt(i);
					if (m_team_role != null) {
						//画出队伍人物
						final int m_index = m_index_change;
						if (!role.m_name.equals(m_team_role.m_name)) {
							m_main_team[m_index].setShow(true);
							m_text_team[m_index].setShow(true);
							m_text_team[m_index].setName(m_team_role.m_name);
							m_text_team[m_index].resetWideHigh();
							//队伍血条
							m_pbar_team[m_index].setPercent(m_team_role.m_hp, m_team_role.m_hpMax);
							m_pbar_team[m_index].setShow(true);
							//人物底图
							if (m_team_role.m_sex == 1 && m_team_role.m_vocation == 1) {//剑男
								m_iamgeBox_team[m_index].setBackground(m_team_jiannan, true);
							}
							else if (m_team_role.m_sex == 1 && m_team_role.m_vocation == 2) { //武男
								m_iamgeBox_team[m_index].setBackground(m_team_wunan, true);
							}
							else if (m_team_role.m_sex == 1 && m_team_role.m_vocation == 3) { //道男
								m_iamgeBox_team[m_index].setBackground(m_team_daonan, true);
							}
							else if (m_team_role.m_sex == 2 && m_team_role.m_vocation == 1) {//剑女
								m_iamgeBox_team[m_index].setBackground(m_team_jiannv, true);
							}
							else if (m_team_role.m_sex == 2 && m_team_role.m_vocation == 2) {//武女
								m_iamgeBox_team[m_index].setBackground(m_team_wunv, true);
							}
							else if (m_team_role.m_sex == 2 && m_team_role.m_vocation == 3) {//道女
								m_iamgeBox_team[m_index].setBackground(m_team_daonv, true);
							}
							m_iamgeBox_team[m_index].setShow(true);

							m_index_change++;
						}
						else if (role.m_name.equals(m_team_role.m_name) && m_team.size() == 1) {
							for (int j = 0; j < 3; j++) {
								m_main_team[j].setShow(false);
								m_text_team[j].setName("");
								m_text_team[j].setShow(false);
								m_pbar_team[j].setShow(false);
								m_iamgeBox_team[j].setShow(false);
							}
							m_MainImageBox[m_main_youjian].setNearAnchor(
									m_MainImageBox[m_main_chongwu], Tools.LEFT_TOP,
									Tools.LEFT_BOTTOM, 0, 10);
							m_imageBox_fix.setNearAnchorUn(m_MainImageBox[m_main_youjian], Tools.LEFT_VCENTER,
									Tools.RIGHT_VCENTER, 10, 0);
						}
						else {
							m_main_team[i].setShow(false);
							m_text_team[i].setName("");
							m_pbar_team[i].setShow(false);
							m_iamgeBox_team[i].setShow(false);
						}

					}
					//else
				}
			}
			else {
				for (int i = 0; i < 3; i++) {
					m_main_team[i].setShow(false);
					m_text_team[i].setName("");
					m_iamgeBox_team[i].setShow(false);
					m_pbar_team[i].setShow(false);
				}
				m_MainImageBox[m_main_youjian].setNearAnchor(
						m_MainImageBox[m_main_chongwu], Tools.LEFT_TOP,
						Tools.LEFT_BOTTOM, 0, 10);
				m_imageBox_fix.setNearAnchorUn(m_MainImageBox[m_main_youjian], Tools.LEFT_VCENTER,
						Tools.RIGHT_VCENTER, 10, 0);
			}
		}
		else {
			m_MainImageBox[m_main_youjian].setNearAnchor(
					m_MainImageBox[m_main_chongwu], Tools.LEFT_TOP,
					Tools.LEFT_BOTTOM, 0, 10);
			m_imageBox_fix.setNearAnchorUn(m_MainImageBox[m_main_youjian], Tools.LEFT_VCENTER,
					Tools.RIGHT_VCENTER, 10, 0);
			for (int i = 0; i < 3; i++) {
				m_main_team[i].setShow(false);
				m_text_team[i].setName("");
				m_iamgeBox_team[i].setShow(false);
				m_pbar_team[i].setShow(false);
			}

		}
	}

	public void stopVer()
	{
		m_VirtualKey.setShow(false);
		m_VirtualKey.setTouch(false);
		m_VirtualKey.m_is_open = false;
	}

	public void logic()
	{
		//施法倒计时
		countDown();

		//大招
		bigSkill();

		//拾取
		refreshPickItems();
		//刷新结婚喊话
		marriageRefreshTime();
		////聊天1秒刷新数据

		ChatCountDown();
		////聊天5秒判断是否有新纪录聊天框是否消失
		Chat_dissolve();
		//刷新小地图上坐标和名字
		updateMap();

		//刷新喊话
		updateNotice();
		//刷新时间
		showTime();
		//显示战斗状态
		fight();
		//领奖倒计时
//		countDownTime();
		//通缉BUFF倒计时
		ChangjingTime();
		stopVirtualKey();

//		m_task.m_key
		//任务提示区动画
		task_anim();

	}

	public boolean m_guaji_state = true;//是否手动点击挂机状态

	/** 任务提示区动画 */
	public void task_anim()
	{
		for (int i = 0; i < DWGameManager.getInstance().m_role.m_drama_list.size(); i++) {
			if (DWGameManager.getInstance().m_role.m_drama_list.get(i).m_status == 2) {
				if (m_task_type == true) {
					m_animBox_renwu.setShow(true);
					if (m_task_time == 0) {
						m_task_time = System.currentTimeMillis();
					}
				}
			}
		}
		long nowtime = System.currentTimeMillis();
		if (nowtime >= m_task_time + 6 * 1000 && nowtime <= m_task_time + 7 * 1000) {
			m_animBox_renwu.setShow(false);
			m_task_type = false;
		}
	}

	public void stopVirtualKey()
	{
		if (m_VirtualKey != null && role != null && m_VirtualKey.m_is_open && ++m_virtual_time > 10) {
			m_virtual_time = 0;
			m_VirtualKey.setShow(false);
			m_VirtualKey.setTouch(false);
			m_VirtualKey.m_is_open = false;
			role.stay(role.m_direct);
		}
	}

	//拾取
	CopyOnWriteArrayList<PickItem> m_pick = new CopyOnWriteArrayList<PickItem>();
	public int m_number = 0;
	public int m_bag_x = DWGameManager.Screen_Width * 3 / 8;//背包位置
	public int m_bag_y = DWGameManager.Screen_Height * 45 / 48;
	public int m_times = 1;
	public int m_w = 0;//图标宽高
	public int m_h = 0;

	public void refreshPickItems()
	{
		pickItemLogic();
		CopyOnWriteArrayList<PickItem> pick = DWGameManager.getInstance().m_role.m_pick_items;
		m_times--;
		if (pick.size() > 0 && m_number < 5 && m_times < 1) {
			m_times = 5;
			PickItem item = pick.get(0);
			item.m_index = m_number;
			int x = (DWGameManager.Screen_Width / 4 + 65 * m_number);
			int y = DWGameManager.Screen_Height * 25 / 48;
			m_imageBox_pickup[m_number] = new DWImageBox(item.m_bitmap);
			m_imageBox_pickup[m_number].setPoint(x, y);
			m_imageBox_pickup[m_number].setShowWideHigh(128, 128);

			m_w = m_imageBox_pickup[m_number].getShowWidth() * 2;
			m_h = m_imageBox_pickup[m_number].getShowHeight() * 2;
			item.m_x = x - 64;
			item.m_y = y - 64;
			item.init(m_bag_x, m_bag_y);
			m_pick.add(item);
			pick.remove(0);
			m_Uimain_Frame.addControl(m_imageBox_pickup[m_number]);
			m_number++;
			item = null;
		}
	}

	public void pickItemLogic()
	{
		int size = m_pick.size();
		if (size < 1) {
			return;
		}
		for (int i = 0; i < size; i++) {
			PickItem pick = (PickItem) m_pick.get(i);
			int index = pick.m_index;
			if (m_imageBox_pickup[index] != null) {
				if (pick.m_time > 0) {
					pick.m_time--;
				}
				else {
					if (pick.m_y >= m_bag_y) {
						m_Uimain_Frame.removeControl(m_imageBox_pickup[index]);
						m_imageBox_pickup[index] = null;
					}
					else {
						pick.m_x += pick.m_speedx;
						pick.m_y += pick.m_speedy;
//		    			 m_w = m_w *29/30;
//		    			 m_h = m_h *29/30;
						m_w = m_w * 8 / 10;
						m_h = m_h * 8 / 10;
						m_imageBox_pickup[index].setShowWideHigh(m_w, m_h);
						m_imageBox_pickup[index].setPoint(pick.m_x, pick.m_y);
					}
				}
			}

		}
		int num = 0;
		for (DWImageBox img : m_imageBox_pickup) {
			if (img == null) {
				num++;
			}
		}
		if (num == m_imageBox_pickup.length) {
			m_pick.clear();
			m_number = 0;
		}
	}

	//施法倒计时
	private void countDown()
	{
		//技能读条
		if (m_skill_flag == true) {
			m_curr++;
			if (m_curr <= m_total) {
				m_pBar_skill.setPercent(m_curr, m_total);
			}
			else {
				m_skill_flag = false;
				if (UIMap.m_is_transit) {
					DWGameManager.getInstance().getSendMessage().sendFunction(UIMap.m_transit_cmd,
							UIMap.m_transit_function);
					removeBar();
				}
				if (UISocial.m_shitu_isOpen) {
					removeBar();
					DWGameManager.getInstance().getSendMessage().sendChuanGongJieSu(
							UIWindows.getInstance().m_social.m_shitu_id);
				}
			}

		}
	}

	//大招
	private void bigSkill()
	{
		m_valib_time--;
		if (m_valib_time < 0) {
			removeBigSkill();
		}
	}

	/**
	 * 时间显示
	 */
	public void showTime()
	{
		long sysTime = System.currentTimeMillis();
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
		CharSequence sysTimeStr = sdf.format(sysTime);
		m_label_showtime.setName("" + sysTimeStr);
		m_label_showtime.resetWideHigh();
		m_label_showtime.setNearAnchor(m_MainImageBox[m_main_xiaoditu], Tools.HCENTER_TOP, Tools.HCENTER_BOTTOM, 0, 0);

	}

	/**
	 * 领奖倒计时
	 */

	public void countDownTime()
	{
		sysTime--;
		if (sysTime <= 0) {
			sysTime = 0;
			m_imageBox_lingjiang.setShow(false);
			m_lable_lingjiang.setShow(false);
			m_lable_lingjiang.setName("");
			m_lable_lingjiang.resetWideHigh();
			m_lable_lingjiang.setNearAnchor(m_imageBox_lingjiang, Tools.HCENTER_TOP, Tools.HCENTER_BOTTOM, 0, 0);
			return;
		}
		int hh = (int) sysTime / 3600;
		int mm = (int) sysTime % 3600 / 60;
		int ss = (int) sysTime % 3600 % 60;
		if (hh == 0) {
			m_lable_lingjiang.setName(mm + ":" + ss);
		}
		else {
			m_lable_lingjiang.setName("" + hh + ":" + mm + ":" + ss);
		}
//		m_imageBox_chengjiu.setShow(false);
//		m_imageBox_chengjiu.setSelect(false);
//		m_imageBox_chengjiu.setSelectType(DWImageBox.SELECT_TYPE_ARC3);
//		m_imageBox_chengjiu.setTouch(false);
		if (!m_imageBox_chengjiu.isShow()) {
			m_imageBox_lingjiang.setShow(true);
			m_lable_lingjiang.setShow(true);
		}
		else {
			m_imageBox_lingjiang.setShow(false);
			m_lable_lingjiang.setShow(false);
		}
		m_lable_lingjiang.resetWideHigh();
		m_lable_lingjiang.setNearAnchor(m_imageBox_lingjiang, Tools.HCENTER_TOP, Tools.HCENTER_BOTTOM, 0, 0);
	}

	/**
	 * 接收礼包倒计时
	 */
	public void recvGetTime(DataInputStream dis) throws IOException
	{
		try {
			long time = dis.readLong();
			sysTime = time;
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**
	 * 是否在战斗
	 */
	public void fight()
	{
		role = DWGameManager.getInstance().m_role;
		if (role.m_combating == false) {
			m_label_fight.setName("");
		}
		else {
			m_label_fight.setName("");
		}
		m_label_fight.resetWideHigh();
		m_label_fight.setNearAnchor(m_MainImageBox[m_main_shangcheng], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 0);
	}

	/**
	 * 刷新主角头像
	 */
	public void updateMyHead()
	{
		//自己信息
		role = DWGameManager.getInstance().m_role;
		if (role != null) {
			m_main_hp = role.m_hp;
			m_main_maxHp = role.m_hpMax;
			m_main_mp = role.m_mp;
			m_main_maxMp = role.m_mpMax;
			//血条
			if (m_main_pb_xue != null) {
				if (m_main_maxHp != 0 && m_main_hp <= m_main_maxHp) {
					m_main_pb_xue.setPercent(m_main_hp, m_main_maxHp);
				}
				else {
					m_main_pb_xue.setPercent(100, 100);
				}
			}
			//蓝条
			if (m_imageBox_nuqi != null) {
				if (m_main_maxMp != 0 && m_main_mp <= m_main_maxMp) {
					int size = m_main_mp * 10 / m_main_maxMp;
					for (int i = 0; i < size; i++) {
						if (m_imageBox_nuqi[i] != null) {
							m_imageBox_nuqi[i].setBackground(m_bm_nuqishang, false);
						}
					}
					for (int j = size; j < 10; j++) {
						if (m_imageBox_nuqi[j] != null) {
							m_imageBox_nuqi[j].setBackground(m_bm_nuqixia, false);
						}
					}
				}
			}
			if (m_main_pb_lan != null) {
				if (role.m_anger <= role.m_angerMax && role.m_angerMax != 0) {
					m_main_pb_lan.setPercent(role.m_anger, role.m_angerMax);
				}
			}
		}
	}

//	/**
//	 *
//	 */
//	public void updateConsume(){
//		role = DWGameManager.getInstance().m_role;
//		Item m_tem = role.getgetShortcutObject(0);
//	}

	public void updateLv()
	{
		role = DWGameManager.getInstance().m_role;
		if (role != null) {
			//等级
			if (m_lb_lv != null) {
				m_lb_lv.setName(Integer.toString(role.m_lv));
				m_lb_lv.resetWideHigh();
			}
		}
	}

	/**
	 * 判断是否开启图标
	 */
	public void updateOpenIcon()
	{
		role = DWGameManager.getInstance().m_role;
		if (role != null) {
			//等级
			if (role.m_lv >= 5) {
				//摇钱树
				m_MainImageBox[m_main_yaoqianshu].setBackground(m_MainBitmap[m_main_yaoqianshu], false);
				m_MainImageBox[m_main_yaoqianshu].setTouch(true);
			}
			else {
				m_MainImageBox[m_main_yaoqianshu].setBackground(m_bm_yaoqianshu, false);
			}
			if (role.m_lv >= 10) {
				//天工坊
				m_MainImageBox[m_main_gongfang].setBackground(m_MainBitmap[m_main_gongfang], false);
				m_MainImageBox[m_main_gongfang].setTouch(true);
			}
			else {
				m_MainImageBox[m_main_gongfang].setBackground(m_bm_gongfang, false);
			}
			if (role.m_lv >= 12) {
				//副本
				m_MainImageBox[m_main_fuben].setBackground(m_MainBitmap[m_main_fuben], false);
				m_MainImageBox[m_main_fuben].setTouch(true);
			}
			else {
				m_MainImageBox[m_main_fuben].setBackground(m_bm_fuben, false);
			}
//			if (role.m_lv >= 18) {
//				//排行
//				DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_C,
//						"你已开启排行");
//				m_MainImageBox[m_main_gonglue].setBackground(m_MainBitmap[m_main_gonglue], false);
//				m_MainImageBox[m_main_gonglue].setTouch(true);
//			}
//			else {
//				m_MainImageBox[m_main_gonglue].setBackground(m_bm_paihang, false);
//			}
			if (role.m_lv >= 15) {
				//祭天台
				m_MainImageBox[m_main_jitian].setBackground(m_MainBitmap[m_main_jitian], false);
				m_MainImageBox[m_main_jitian].setTouch(true);
			}
			else {
				m_MainImageBox[m_main_jitian].setBackground(m_bm_jitiantai, false);
			}
			if (role.m_lv >= 25) {
				//炼丹
				m_MainImageBox[m_main_liandan].setBackground(m_MainBitmap[m_main_liandan], false);
				m_MainImageBox[m_main_liandan].setTouch(true);
			}
			else {
				m_MainImageBox[m_main_liandan].setBackground(m_bm_liandan, false);
			}
			if (role.m_lv >= 12) {
				//炼魂
				m_MainImageBox[m_main_lianhun].setBackground(m_MainBitmap[m_main_lianhun], false);
				m_MainImageBox[m_main_lianhun].setTouch(true);
			}
			else {
				m_MainImageBox[m_main_lianhun].setBackground(m_bm_lianhun, false);
			}

			if (role.m_lv >= 30) {
				//提示框图标开启
				m_task_close.setShow(true);
				m_task_close.setTouch(true);
			}
			else {
				m_task_close.setShow(false);
				m_task_close.setTouch(false);
			}

		}
	}

	public GameActor m_HeadTarget;

	/**
	 * 刷新目标头像数据
	 */
	public void updateTargetHead()
	{
		//画被选中角色
		try {
			GameActor target = DWGameManager.getInstance().m_role.m_targetActor;
			if (target == null) {
				m_HeadTarget = null;
			}
			else {
				if (m_HeadTarget != null && m_HeadTarget.m_gameId == target.m_gameId) {
					m_checked_hp = target.m_hp;
					m_checked_maxHp = target.m_hpMax;
					// 被选中人物血条
					if (m_checked_maxHp != 0 && m_checked_hp <= m_checked_maxHp) {
						m_checked_xue.setPercent(m_checked_hp, m_checked_maxHp);
					}
					else {
						m_checked_xue.setPercent(100, 100);
					}
					return;
				}
			}
			if (target != null && target.m_anim != null) {
				m_HeadTarget = target;
				m_checked_lv.setName(Integer.toString(target.m_lv));
				m_checked_lv.resetWideHigh();
				m_text_checked.setName(target.m_name);
				m_text_checked.resetWideHigh();
				m_checked_hp = target.m_hp;
				m_checked_maxHp = target.m_hpMax;
				aBox.setAnimation(target);
				aBox.setTouch(true);
				aBox.setAction(target.m_anim.m_actions.length - 1);
				m_checked_xue.setShow(true);
				m_bacBackground_checked.setShow(true);
			}
			else {
				m_text_checked.setName("");
				m_checked_lv.setName("");
				aBox.setAnimation(null);
				aBox.setTouch(false);
				m_checked_xue.setShow(false);
				m_bacBackground_checked.setShow(false);
			}
			// 被选中人物血条
			if (m_checked_maxHp != 0 && m_checked_hp <= m_checked_maxHp) {
				m_checked_xue.setPercent(m_checked_hp, m_checked_maxHp);
			}
			else {
				m_checked_xue.setPercent(100, 100);
			}
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**
	 * 刷新技能栏
	 */
	public void updateSkillSet()
	{
		//自己的技能
		role = DWGameManager.getInstance().m_role;
		m_main_roleskill[0] = role.getShortcutObject(Role.SHORTCUT_SKILL0);
		m_main_roleskill[1] = role.getShortcutObject(Role.SHORTCUT_SKILL1);
		m_main_roleskill[2] = role.getShortcutObject(Role.SHORTCUT_SKILL2);
		m_main_roleskill[3] = role.getShortcutObject(Role.SHORTCUT_SKILL3);
		m_main_roleskill[4] = role.getShortcutObject(Role.SHORTCUT_CONSUME);//吃药
		if (UIWindows.getInstance().m_bag != null && UIWindows.getInstance().m_bag.m_shortcut_consume != null) {
			UIWindows.getInstance().m_bag.m_shortcut_consume.m_data = (Cell) m_main_roleskill[4];
		}
		m_main_roleskill[5] = role.getShortcutObject(Role.SHORTCUT_RIDE);//坐骑
		if (m_main_roleskill != null) {
			m_grid_dizi[2].addObject(m_main_roleskill[0]);// 0-3 由下向上
			m_grid_dizi[1].addObject(m_main_roleskill[1]);
			m_grid_dizi[0].addObject(m_main_roleskill[2]);
			m_grid_dizi[3].addObject(m_main_roleskill[4]);//吃药
			m_grid_dizi[4].addObject(m_main_roleskill[5]);//坐骑
			if (m_main_roleskill[5] == null) {
				m_grid_dizi[4].removeObject();
			}

		}
	}

	/**
	 * 刷新道具栏
	 */
	public void updateItemSet()
	{

	}

	/**
	 * 刷新队友
	 */
	public void updateTeam()
	{
		//队伍
		teamList();
	}

	/**
	 * 刷新可接任务
	 */
	public void updateAccessTask()
	{

	}

	/**
	 * 刷新经验条
	 */
	public void updateExp()
	{
		role = DWGameManager.getInstance().m_role;
		//经验条
		if (role.m_maxExp != 0 && role.m_exp <= role.m_maxExp) {
			if (m_pBar_exp != null) {
				m_pBar_exp.setPercent(role.m_exp, role.m_maxExp);
			}
		}
		else {
			if (m_pBar_exp != null) {
				m_pBar_exp.setPercent(100, 100);
			}
		}

	}

	/**
	 * 刷新自己buff
	 */
	public void updateMyBuff()
	{
		try {
			role = DWGameManager.getInstance().m_role;
			ConcurrentHashMap<Long, ActorBuffer> m_main_buff = role.m_buf;//自己身上的buff

			Object[] buffs = m_main_buff.values().toArray();
			for (int i = 0; i < m_grid_main_buff.length; i++) {
				if (m_grid_main_buff[i] != null) {
					m_grid_main_buff[i].removeObject();
					if (i < buffs.length) {
						ActorBuffer buff = (ActorBuffer) buffs[i];
						m_grid_main_buff[i].addObject(buff);
						m_grid_main_buff[i].setShow(true);
					}
				}
			}
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**
	 * 刷新目标buff
	 */
	public void updateTargetBuff()
	{
//		ConcurrentHashMap<Long, ActorBuffer> m_target_buff = m_main_role.m_targetActor.m_buf;//目标升上的buff
//		ConcurrentHashMap<Long, ActorBuffer> m_target_debuff = m_main_role.m_targetActor.m_debuf;//目标身上的debuff

	}

	/**
	 * 刷新小地图
	 */
	public void updateMap()
	{
		role = DWGameManager.getInstance().m_role;
		if (m_text_point != null) {
			m_text_point.setName((role.m_posX / 32) + "," + (role.m_posY / 32));
			m_text_point.resetWideHigh();
			m_text_point.setNearAnchor(m_imageBox_location, Tools.RIGHT_TOP, Tools.RIGHT_BOTTOM, 0, 0);
		}
//		refreshMapName();
	}

	/**
	 * 刷新安全区提示
	 */
	public void refreshMapName()
	{
		role = DWGameManager.getInstance().m_role;
		if (DWGameManager.getInstance().m_map_name != null && m_text_location != null) {

			if (DWGameManager.getInstance().m_scene_type == 0) {
				m_text_location.setName(DWGameManager.getInstance().m_map_name + "(安全)");//黑色
				m_text_location.setTextColor(Color.GREEN);
			}
			else {
				m_text_location.setName(DWGameManager.getInstance().m_map_name + "(战斗)");//红色
				m_text_location.setTextColor(Color.RED);
			}
			m_text_location.resetWideHigh();
			m_text_location.setNearAnchor(m_Uimain_Frame, Tools.RIGHT_TOP, Tools.RIGHT_TOP, 0, 0);
		}
	}

	/**
	 * 刷新公告
	 */
	public void updateNotice()
	{
		//喊话
//		玩家喊话
		ArrayList m_hanhua = DWGameManager.getInstance().m_sys_world_message;
		if (m_hanhua != null
				&& m_hanhua.size() > 0) {
			if (!DWControlsManager.getInstance().contains(m_horn_frame)) {
				DWControlsManager.getInstance().addControl(m_horn_frame);
			}
			String m_system_str = (String) m_hanhua.get(0);
//				m_horn_frame.setShow(true);
//				m_imageBox_hanhua.setShow(true);
			m_tabPage_hanhua.setSelect(true);
			int m_type = Integer.parseInt(m_system_str.substring(0, 2));
			if (m_type == 0) {//系统
				m_tabPage_hanhua.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0,
						15);
			}
			else if (m_type == 1) {//赤诚
//					m_ab_chicheng.setShow(true);
				m_imageBox_hanhua.setBackground(m_bm_chicheng, true);
				m_tabPage_hanhua.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 18);
			}
			else if (m_type == 2) {//愤怒
				m_ab_chouhenright.setShow(true);
				m_imageBox_hanhua.setBackground(m_bm_fennu, true);
				m_tabPage_hanhua.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 20);

			}
			else if (m_type == 3) {//感激
//					m_ab_ganji.setShow(true);
//					m_ab_ganji1.setShow(true);
				m_imageBox_hanhua.setBackground(m_bm_ganji, true);
				m_tabPage_hanhua.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 18);
			}
			else if (m_type == 4) {//仇恨
//					m_ab_chouhenleft.setShow(true);
//					m_ab_chouhenright.setShow(true);
				m_imageBox_hanhua.setBackground(m_bm_chouhen, true);
				m_tabPage_hanhua.setNearAnchor(m_imageBox_hanhua, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 18);
			}

//				String temp = m_textBox_hanhua.getText();
//				if( temp == null){
//					int type = Tools.random(0, 1);
//					int Trajectory = Tools.random(0, 1);
//					m_textBox_hanhua.setName(""+type);
//					if(DWGameManager.getInstance().m_role != null && DWGameManager.getInstance().m_role.m_scene != null){
//						if(type == ParticleConstants.类型_花瓣){
//							Trajectory = ParticleConstants.轨迹_花瓣;
//						}
//						DWGameManager.getInstance().m_role.m_scene.startParticle(type,Trajectory);
//					}
//				}
			m_textBox_hanhua.setText(m_system_str.substring(2));
			if (m_hanhua.size() >= 3) {//池中达到限额后 加速第一条
				m_x += 15;
			}
			else {
				m_x += 7;
			}

//				int a =(250 + m_textBox_hanhua.getShowWidth())/10;
//				m_x += a;
			if ((420 + m_textBox_hanhua.getShowWidth()) >= m_x) {
				m_textBox_hanhua.setPoint(420 - m_x, 0);
			}
			else {
				m_textBox_hanhua.setText(null);
//					m_imageBox_hanhua.setShow(false);
				m_tabPage_hanhua.setSelect(false);
				m_ab_chicheng.setShow(false);
				m_ab_fennu.setShow(false);
				m_ab_chouhenleft.setShow(false);
				m_ab_chouhenright.setShow(false);
				m_ab_ganji.setShow(false);
				m_ab_ganji1.setShow(false);
				DWControlsManager.getInstance().removeControl(m_horn_frame);
				m_x = 0;
//					m_horn_frame.setShow(false);
				m_hanhua.remove(0);
//					int index = Integer.parseInt(m_textBox_hanhua.getName());
//					m_textBox_hanhua.setName(null);
//					if(DWGameManager.getInstance().m_role != null && DWGameManager.getInstance().m_role.m_scene != null){
//						DWGameManager.getInstance().m_role.m_scene.closeParticle(index);
//					}
			}
		}

		//系统喊话
		if (DWGameManager.getInstance().m_sys_message != null && DWGameManager.getInstance().m_sys_message.size() != 0) {
			if (DWControlsManager.getInstance().contains(m_system_frame) == false) {
				DWControlsManager.getInstance().addControl(m_system_frame);
			}
			ArrayList m_system_hanhua = DWGameManager.getInstance().m_sys_message;
//			for (int i = 0; i < m_system_hanhua.size(); i++) {
			String m_system_str = (String) m_system_hanhua.get(0);
//				m_horn_frame.setShow(true);
//				m_imageBox_hanhua.setShow(true);
			m_system_tabPage.setSelect(true);
			int m_type = Integer.parseInt(m_system_str.substring(0, 2));
			if (m_type == 0) {//系统
				m_system_tabPage.setNearAnchor(m_system_imageBox, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0,
						15);
			}

			m_system_textBox.setText(m_system_str.substring(2));
			if (m_system_hanhua.size() >= 3) {//池中达到限额后 加速第一条
				m_system_x += 15;
			}
			else {
				m_system_x += 6;
			}
			if ((600 + m_system_textBox.getShowWidth()) >= m_system_x) {
				m_system_textBox.setPoint(600 - m_system_x, 0);
			}
			else {
				m_system_textBox.setText(null);
//					m_imageBox_hanhua.setShow(false);
				m_system_tabPage.setSelect(false);
				DWControlsManager.getInstance().removeControl(m_system_frame);
				m_system_x = 0;
//					m_horn_frame.setShow(false);
				m_system_hanhua.remove(0);
			}
//			}
		}

//		else {
//			m_imageBox_hanhua.setShow(false);
//			m_tabPage_hanhua.setSelect(false);
//			m_ab_chicheng.setShow(false);
//			m_ab_fennu.setShow(false);
//			m_ab_chouhenleft.setShow(false);
//			m_ab_chouhenright.setShow(false);
//			m_ab_ganji.setShow(false);
//			m_ab_ganji1.setShow(false);
//		}
	}

	/**
	 * 刷新聊天栏
	 */

	public void ChatUpdate()
	{
		Role role = DWGameManager.getInstance().m_role;
		if (role != null && role.m_is_update_chat) {
			ChatItem[] chats = role.getChatItemFitType(ChatItem.TYPE_QUAN);
			if (chats != null && m_chat_lb != null && m_chat_page != null) {
				StringBuffer strBuffer = new StringBuffer();
				for (int i = chats.length - 1, k = 0; i >= 0; i--) {
					if (k > 0) {
						strBuffer.insert(0, DWControlTools.CHANGE_ROW);
					}
					strBuffer.insert(0, chats[i].m_content);
					k++;
					if (k > 3) {
						break;
					}
				}
				m_chat_lb.setText(strBuffer.toString());
				m_chat_lb.setShow(true);
				m_chat_bg.setShow(true);
				m_chat_lb.setNearAnchor(m_chat_page, Tools.LEFT_BOTTOM, Tools.LEFT_BOTTOM);
				m_chat_lb.setPointUn(m_chat_lb.getShowX() - m_chat_page.getShowX(), m_chat_lb.getShowY()
						- m_chat_page.getShowY());
				role.m_is_update_chat = false;
			}
		}
	}

	private int m_jishi = 1;
	long m_start_time = 0;
	long m_next_second = 0;
	private int m_num = 0;
	private long m_total_time = 0;//10分钟发送一条指令

	public void ChatCountDown()
	{
		if (m_start_time == 0) {
			m_start_time = System.currentTimeMillis();///开始倒计时时截取系统时间
			m_next_second = m_start_time + 1000;
		}
		long m_currrent_time = System.currentTimeMillis();
		if (m_currrent_time >= m_next_second) {
			m_num++;
			ChatUpdate();
			countDownTime();
			if (m_num == 30) {//自动伸缩后执行
				m_MainImageBox[m_main_xiayincang].setBackground(m_MainBitmap[m_main_shangyinchang], true);//-号
				flag = true;
			}

			//10分钟外发一条指令
			m_total_time++;
			if (m_total_time == 600) {
				m_total_time = 0;
				DWGameManager.getInstance().getSendMessage().sendPrizeMessage();
			}

			m_start_time = m_next_second;
			m_next_second += 1000;
		}
	}

	private final int CHAT_DIS = 10000;
	private long m_chat_dis = 0;
	private long m_chat_cur = 0;

	public void Chat_dissolve()
	{
		Role role = DWGameManager.getInstance().m_role;
		if (role != null && m_chat_lb != null) {
			if (!role.m_is_update_chat && m_chat_lb.isShow()) {
				m_chat_cur = System.currentTimeMillis();
				if (m_chat_dis == 0) {
					m_chat_dis = m_chat_cur;
				}
				if (m_chat_cur - m_chat_dis >= CHAT_DIS) {
					m_chat_dis = 0;
					m_chat_lb.setShow(false);
					m_chat_bg.setShow(false);
				}
			}
		}
	}

	public static boolean s_showNewMail;//全局-是否显示新邮件

	/**
	 * 邮件图标的状态显示
	 * @param flag
	 */
	public boolean m_tishi_mail_flag = true;

	public void showNewMial(boolean flag)
	{
		s_showNewMail = flag;
		if (s_showNewMail == true) {
			m_MainImageBox[m_main_youjian].setBackground(m_bm_haveMail, false);
		}
		else {
			m_MainImageBox[m_main_youjian].setBackground(m_MainBitmap[m_main_youjian], false);
		}
	}

	public void recvNewMailShow(DataInputStream dis) throws IOException
	{
		try {
			short state = dis.readShort(); ///新邮件的个数
			Tools.debugPrintln("新邮件主界面提示的指令state=" + state);
			if (state > 0) {
				s_showNewMail = true;
				m_tishi_mail_flag = false;
				DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "亲，您有新邮件啦，快代开看看吧 ^@^");
			}
			else {
				s_showNewMail = false;
			}
			showNewMial(s_showNewMail);
		}
		catch (Exception e) {
			Tools.debug(e);
		}

	}

	public static final byte ACCOUNT_MANAGE_PASSWORD = 0;//账号管理 - 修改密码
	public static final byte ACCOUNT_MANAGE_BINDING = 1;//账号绑定
	public static final byte ACCOUNT_MANAGE_BACK = 2;//找回账号
	public static final byte ACCOUNT_MANAGE_UNBIND = 3;//解除绑定

	public void recvNpcUser(byte type)
	{
		switch (type) {
			case ACCOUNT_MANAGE_PASSWORD:
				Login m_login_up = new Login();
				m_login_up.Read();
				Updatepassword();
				break;
			case ACCOUNT_MANAGE_BINDING:
				//注释掉。。
//				if (ChannelOperation.isChannelSDK == true)
//				{
//					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "抱歉，您所下载的渠道包无法绑定账号。");
//				}
//				else
				{
					Login m_login_bind = new Login();
					m_login_bind.Read();
					Bind_on_Account();
				}
				break;
			case ACCOUNT_MANAGE_BACK:
				Retrieve();
				break;
			case ACCOUNT_MANAGE_UNBIND:
				UnBind();
				break;
		}
	}

	private DWFrame m_Update_Frame = null;
	public DWInputBox m_u_ib1;
	public DWInputBox m_u_ib2;
	public DWInputBox m_u_ib3;
	public DWInputBox m_u_ib4;

	Bitmap m_cr_tit = null;
	Bitmap m_cr_dbj = null;
	Bitmap m_cr_button = null;
	Bitmap m_cr_but_bianhou = null;
	Bitmap m_cr_tuichu = null;

	public DWBackground m_xbj_bg;
	public DWImageBox m_tit_ima;
	public DWImageBox m_tuichu_ima;
	public DWTitle m_u_tit;
	public DWLabel m_u_lab1 = new DWLabel("当前账号");
	public DWLabel m_u_lab2 = new DWLabel("当前密码");
	public DWLabel m_u_lab3 = new DWLabel("新密码");
	public DWLabel m_u_lab4 = new DWLabel("确认新密码");
	public DWButton m_u_but1;
	public DWTextbox m_u_t_1;
	public DWTextbox m_u_t_2;
	public DWTextbox m_u_t_3;
	public DWFrame m_change_frame;

	public void Updatepassword()
	{
		m_cr_tit = UIWindows.createImage("/img/newui/xiugaimima_1.gnp");
		m_cr_dbj = UIWindows.createImage("/img/newui/denglubjt_1.gnp"); /////大背景
		m_cr_button = UIWindows.createImage("/img/newui/anniu_6.gnp"); ////按钮的图片
		m_cr_but_bianhou = UIWindows.createImage("/img/newui/anniu_6ax.gnp"); ////按钮点击后变的图片
		m_cr_tuichu = UIWindows.createImage("/img/newui/fanhuianniu_1.gnp"); /////叉键退出

		if (DWControlsManager.getInstance().contains(m_change_frame)) {
			if (m_change_frame != null) {
				DWControlsManager.getInstance().removeControl(m_change_frame);
			}
		}
		m_change_frame = new DWFrame(DWGameManager.Screen_Width - 200, DWGameManager.Screen_Height - 180);
		m_change_frame.setClickClose(false);
		m_change_frame.setCentre();
		DWControlsManager.getInstance().addControl(m_change_frame);

		///////小背景
		m_xbj_bg = new DWBackground(DWGameManager.Screen_Width - 200, DWGameManager.Screen_Height - 180);
		m_xbj_bg.setNearAnchor(m_change_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		///////标题
		m_u_tit = new DWTitle("", m_change_frame);
		m_u_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8, 0);
		m_u_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16, m_u_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_u_tit, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		///////退出按键
		DWImageBox m_tuichu_ima = new DWImageBox(m_cr_tuichu);
		m_tuichu_ima.setTouchZoomIn(40, 40);
		m_tuichu_ima.setNearAnchor(m_u_tit, Tools.RIGHT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_tuichu_ima.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				DWControlsManager.getInstance().removeControl(m_change_frame);
			}
		});

		//////标签
		m_u_lab1.setShowWideHigh(m_u_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		int m_y = (m_xbj_bg.getShowHeight() - 4 * m_u_lab1.getShowHeight() - m_cr_button.getHeight() - 20) / 5;
		m_u_lab1.setBackgroundColor(Tools.ALPHA);
		m_u_lab1.setTextColor(0xFFFFBB11);
		m_u_lab1.setNearAnchor(m_xbj_bg, Tools.LEFT_TOP,
				Tools.LEFT_TOP, m_xbj_bg.getShowWidth() / 5, m_y);

		m_u_lab2.setShowWideHigh(m_u_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_u_lab2.setBackgroundColor(Tools.ALPHA);
		m_u_lab2.setTextColor(0xFFFFBB11);
		m_u_lab2.setNearAnchor(m_u_lab1, Tools.LEFT_TOP,
				Tools.LEFT_BOTTOM, 0, m_y);

		m_u_lab3.setShowWideHigh(m_u_lab3.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_u_lab3.setBackgroundColor(Tools.ALPHA);
		m_u_lab3.setTextColor(0xFFFFBB11);
		m_u_lab3.setNearAnchor(m_u_lab2, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);

		m_u_lab4.setShowWideHigh(m_u_lab4.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_u_lab4.setBackgroundColor(Tools.ALPHA);
		m_u_lab4.setTextColor(0xFFFFBB11);
		m_u_lab4.setNearAnchor(m_u_lab3, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);

		/////4个输入框
		Login.Read();
		m_u_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_change_frame);
		m_u_ib1.setNearAnchor(m_u_lab1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		m_u_ib1.setText(Login.m_back_l_ib1);
		m_u_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_u_t_1.setNearAnchor(m_u_ib1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		m_u_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_change_frame);
		m_u_ib2.setNearAnchor(m_u_lab2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);

		m_u_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_u_t_2.setNearAnchor(m_u_ib2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		m_u_ib3 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_change_frame);
		m_u_ib3.setNearAnchor(m_u_lab3, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		m_u_t_3 = new DWTextbox("(6~11个数字或字母)");
		m_u_t_3.setNearAnchor(m_u_ib3, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		m_u_ib4 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_change_frame);
		m_u_ib4.setNearAnchor(m_u_lab4, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);

		m_u_but1 = new DWButton("修改密码", m_cr_button);
		m_u_but1.setDownImage(m_cr_but_bianhou);
		m_u_but1.addListener(update_button1_lis);
		m_u_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -10, -20);

		m_change_frame.addControl(m_xbj_bg);
		m_change_frame.addControl(m_u_tit);
		m_change_frame.addControl(m_tit_ima);
		m_change_frame.addControl(m_tuichu_ima);
		m_change_frame.addControl(m_u_lab1);
		m_change_frame.addControl(m_u_lab2);
		m_change_frame.addControl(m_u_lab3);
		m_change_frame.addControl(m_u_lab4);
		m_change_frame.addControl(m_u_ib1);
		m_change_frame.addControl(m_u_ib2);
		m_change_frame.addControl(m_u_ib3);
		m_change_frame.addControl(m_u_ib4);
		m_change_frame.addControl(m_u_but1);
		m_change_frame.addControl(m_u_t_1);
		m_change_frame.addControl(m_u_t_2);
		m_change_frame.addControl(m_u_t_3);
	}

	private DWListener update_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{

			if (m_u_ib1.getText().equals("") || m_u_ib1.getText() == null) {
				DWGameManager.getInstance().showToast("账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionLetterNumbers(m_u_ib1.getText())) {
					DWGameManager.getInstance().showToast("账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_u_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast("账号不能少于6个字符!",
								Toast.LENGTH_LONG);
					}
					else if (m_u_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast("账号不能高于11个字符!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_u_ib2.getText() == null
								|| m_u_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("当前密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection.detectionLetterNumbers(m_u_ib2.getText())) {
								DWGameManager.getInstance().showToast(
										"当前密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_u_ib2.getText().length() < 4) {
									DWGameManager.getInstance().showToast(
											"当前密码不能少于4个字符!", Toast.LENGTH_LONG);
								}
								else if (m_u_ib2.getText().length() > 11) {
									DWGameManager.getInstance()
											.showToast("当前密码不能高于11个字符!",
													Toast.LENGTH_LONG);
								}
								else {
									if (m_u_ib3.getText() == null
											|| m_u_ib3.getText().equals("")) {
										DWGameManager.getInstance().showToast(
												"新密码不能为空!", Toast.LENGTH_LONG);
									}
									else {
										if (!DWCharsDetection.detectionLetterNumbers(m_u_ib3.getText())) {
											DWGameManager.getInstance()
													.showToast("新密码只允许输入数字与字母!",
															Toast.LENGTH_LONG);
										}
										else {
											if (m_u_ib3.getText().length() < 4) {
												DWGameManager
														.getInstance()
														.showToast(
																"新密码不能少于4个字符!",
																Toast.LENGTH_LONG);
											}
											else if (m_u_ib3.getText()
													.length() > 11) {
												DWGameManager
														.getInstance()
														.showToast(
																"新密码不能高于11个字符!",
																Toast.LENGTH_LONG);
											}
											else {
												if (m_u_ib3.getText().equals(
														m_u_ib2.getText())) {
													DWGameManager
															.getInstance()
															.showToast(
																	"新密码不能和当前密码相同!",
																	Toast.LENGTH_LONG);
												}
												else {
													if (m_u_ib4.getText() == null
															|| m_u_ib4
																	.getText()
																	.equals("")) {
														DWGameManager
																.getInstance()
																.showToast(
																		"确认新密码不能为空!",
																		Toast.LENGTH_LONG);
													}
													else {
														if (!m_u_ib4
																.getText()
																.equals(
																		m_u_ib3
																				.getText())) {
															DWGameManager
																	.getInstance()
																	.showToast(
																			"确认新密码输入错误!",
																			Toast.LENGTH_LONG);
														}
														else {
															DWGameManager.getInstance().getSendMessage()
																	.sendUserChangePassword(m_u_ib1.getText(),
																			m_u_ib2.getText(),
																			m_u_ib3.getText());
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	};

	public DWInputBox m_bind_ib1;
	public DWInputBox m_bind_ib2;
	public DWInputBox m_bind_ib3;
	public DWInputBox m_bind_ib4;
	public DWTextbox m_bind_tb;
	public DWLabel m_bind_lab1;

	public DWLabel m_bind_lab2;

	public DWLabel m_bind_lab3;

	public DWLabel m_bind_lab4;
	public DWTextbox m_bind_t_1;
	public DWTextbox m_bind_t_2;
	public DWButton m_bind_but1;
	public DWTitle m_bind_tit;
	public DWFrame m_bind_frame = null;

	public void Bind_on_Account()
	{
		m_cr_tit = UIWindows.createImage("/img/newui/zhanghaobangding_1.gnp");
		m_cr_dbj = UIWindows.createImage("/img/newui/denglubjt_1.gnp"); /////大背景

		m_cr_button = UIWindows.createImage("/img/newui/anniu_6.gnp"); ////按钮的图片
		m_cr_but_bianhou = UIWindows.createImage("/img/newui/anniu_6ax.gnp"); ////按钮点击后变的图片
		m_cr_tuichu = UIWindows.createImage("/img/newui/fanhuianniu_1.gnp"); /////叉键退出

		if (DWControlsManager.getInstance().contains(m_bind_frame)) {
			if (m_bind_frame != null) {
				DWControlsManager.getInstance().removeControl(m_bind_frame);
			}
		}

		m_bind_frame = new DWFrame(DWGameManager.Screen_Width - 180, DWGameManager.Screen_Height - 130);
		m_bind_frame.setCentre();
		m_bind_frame.setClickClose(false);
		DWControlsManager.getInstance().addControl(m_bind_frame);

		///////小背景
		m_xbj_bg = new DWBackground(DWGameManager.Screen_Width - 180, DWGameManager.Screen_Height - 130);
		m_xbj_bg.setNearAnchor(m_bind_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		///////标题
		m_bind_tit = new DWTitle("", m_bind_frame);
		m_bind_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8, 0);
		m_bind_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16, m_bind_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setTouchZoomIn(40, 40);
		m_tit_ima.setNearAnchor(m_bind_tit, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		///////退出按键
		DWImageBox m_tuichu_ima = new DWImageBox(m_cr_tuichu);
		m_tuichu_ima.setTouchZoomIn(40, 40);
		m_tuichu_ima.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				DWControlsManager.getInstance().removeControl(m_bind_frame);
			}
		});
		m_tuichu_ima.setNearAnchor(m_bind_tit, Tools.RIGHT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);

		//////标签
		m_bind_lab1 = new DWLabel("账号");
		m_bind_lab1.setBackgroundColor(Tools.ALPHA);
		m_bind_lab1.setTextColor(0xFFFFBB11);
		m_bind_lab1.setShowWideHigh(m_bind_lab1.getShowWidth(), 30);

		m_bind_lab2 = new DWLabel("密码");
		m_bind_lab2.setBackgroundColor(Tools.ALPHA);
		m_bind_lab2.setTextColor(0xFFFFBB11);
		m_bind_lab2.setShowWideHigh(m_bind_lab2.getShowWidth(), 30);

		m_bind_lab3 = new DWLabel("绑定手机号");
		m_bind_lab3.setBackgroundColor(Tools.ALPHA);
		m_bind_lab3.setTextColor(0xFFFFBB11);
		m_bind_lab3.setShowWideHigh(m_bind_lab3.getShowWidth(), 30);

		m_bind_lab4 = new DWLabel("绑定邮箱");
		m_bind_lab4.setBackgroundColor(Tools.ALPHA);
		m_bind_lab4.setTextColor(0xFFFFBB11);
		m_bind_lab4.setShowWideHigh(m_bind_lab4.getShowWidth(), 30);

		/////4个输入框
		Login.Read();
		m_bind_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_bind_frame);
		m_bind_ib1.setText(Login.m_back_l_ib1);

		m_bind_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_bind_frame);

		m_bind_ib3 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_bind_frame);

		m_bind_ib4 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_bind_frame);

		m_bind_tb = new DWTextbox("<mark c=55FF00>" +
				"绑定手机号方便您找回自己的账号密码,请仔细确认输入的手机号和邮箱的正确性。" + "</mark>", m_bind_ib4
				.getShowWidth() + m_bind_lab4.getShowWidth() + 150);
		//标签1  输入框1
		int m_y = (m_xbj_bg.getShowHeight() - 4 * m_bind_lab1.getShowHeight() - m_bind_tb.getShowHeight()
				- m_cr_button.getHeight() - 20) / 6;
		m_bind_lab1.setNearAnchor(m_xbj_bg, Tools.LEFT_TOP,
				Tools.LEFT_TOP, m_xbj_bg.getShowWidth() / 3 - 30,
				m_y);

		m_bind_ib1.setNearAnchor(m_bind_lab1, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20, 0);

		m_bind_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_bind_t_1.setNearAnchor(m_bind_ib1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		//标签2  输入框2
		m_bind_lab2.setNearAnchor(m_bind_lab1, Tools.LEFT_TOP,
				Tools.LEFT_BOTTOM, 0, m_y);
		m_bind_ib2.setNearAnchor(m_bind_lab2, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20, 0);

		m_bind_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_bind_t_2.setNearAnchor(m_bind_ib2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		//标签3  输入框3
		m_bind_lab3.setNearAnchor(m_bind_lab2, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);
		m_bind_ib3.setNearAnchor(m_bind_lab3, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20, 0);

		//标签4  输入框4
		m_bind_lab4.setNearAnchor(m_bind_lab3, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);
		m_bind_ib4.setNearAnchor(m_bind_lab4, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20, 0);

		////////////textbox5
		m_bind_tb.setNearAnchor(m_bind_lab4, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, -100, 10);

		//////按钮
		m_bind_but1 = new DWButton("绑定账号", m_cr_button);
		m_bind_but1.setDownImage(m_cr_but_bianhou);
		m_bind_but1.addListener(Bind_button1_lis);
		m_bind_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -10, -20);

		m_bind_frame.addControl(m_xbj_bg);
		m_bind_frame.addControl(m_bind_tit);
		m_bind_frame.addControl(m_tit_ima);
		m_bind_frame.addControl(m_tuichu_ima);
		m_bind_frame.addControl(m_bind_lab1);
		m_bind_frame.addControl(m_bind_lab2);
		m_bind_frame.addControl(m_bind_lab3);
		m_bind_frame.addControl(m_bind_lab4);
		m_bind_frame.addControl(m_bind_ib1);
		m_bind_frame.addControl(m_bind_ib2);
		m_bind_frame.addControl(m_bind_ib3);
		m_bind_frame.addControl(m_bind_ib4);
		m_bind_frame.addControl(m_bind_but1);
		m_bind_frame.addControl(m_bind_tb);
		m_bind_frame.addControl(m_bind_t_1);
		m_bind_frame.addControl(m_bind_t_2);
	}

	private DWListener Bind_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{

			if (m_bind_ib1.getText() == null || m_bind_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionLetterNumbers(m_bind_ib1.getText())) {
					DWGameManager.getInstance().showToast("账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_bind_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast("账号不能少于6个字符!",
								Toast.LENGTH_LONG);
					}
					else if (m_bind_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast("账号不能高于11个字符!",
								Toast.LENGTH_LONG);
					}
					else {
						if (m_bind_ib2.getText() == null
								|| m_bind_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection.detectionLetterNumbers(m_bind_ib1.getText())) {
								DWGameManager.getInstance().showToast(
										"密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_bind_ib2.getText().length() < 6) {
									DWGameManager.getInstance().showToast(
											"密码不能少于6个字符!", Toast.LENGTH_LONG);
								}
								else if (m_bind_ib2.getText().length() > 11) {
									DWGameManager.getInstance().showToast(
											"密码不能高于11个字符!", Toast.LENGTH_LONG);
								}
								else {
									if (m_bind_ib3.getText() == null
											|| m_bind_ib3.getText().equals("")) {
										DWGameManager.getInstance().showToast(
												"绑定的手机号不能为空!",
												Toast.LENGTH_LONG);
									}
									else {
										if (!DWCharsDetection.detectionNumbers(m_bind_ib3
												.getText())) {
											DWGameManager.getInstance()
													.showToast("绑定的手机号格式不对，必须全是数字!",
															Toast.LENGTH_LONG);
										}
										else {
											if (m_bind_ib4.getText() == null
													|| m_bind_ib4
															.getText()
															.equals("")) {
												DWGameManager
														.getInstance()
														.showToast(
																"绑定的邮箱不能为空!",
																Toast.LENGTH_LONG);
											}
											else {
												if (!DWCharsDetection.detectionMail(m_bind_ib4.getText()))
												{
													DWGameManager.getInstance().showToast("绑定的邮箱格式不对!",
															Toast.LENGTH_LONG);
												}
												else
												{
													DWGameManager.getInstance().getSendMessage().sendUserBinding(
															m_bind_ib1.getText(), m_bind_ib2.getText(),
															m_bind_ib3.getText(),
															m_bind_ib4.getText());
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	};

	public DWInputBox m_rt_ib1;
	public DWInputBox m_rt_ib2;
	public DWTitle m_rt_tit;
	public DWLabel m_rt_lab1;
	public DWLabel m_rt_lab2;
	public DWTextbox m_rt_tb;
	public DWButton m_rt_but1;

	public DWFrame m_ret_frame = null;

	public void Retrieve()
	{
		m_cr_tit = UIWindows.createImage("/img/newui/zhaohuizhanghao_1.gnp");
		m_cr_dbj = UIWindows.createImage("/img/newui/denglubjt_1.gnp"); /////大背景
		m_cr_button = UIWindows.createImage("/img/newui/anniu_6.gnp"); ////按钮的图片
		m_cr_but_bianhou = UIWindows.createImage("/img/newui/anniu_6ax.gnp"); ////按钮点击后变的图片
		m_cr_tuichu = UIWindows.createImage("/img/newui/fanhuianniu_1.gnp"); /////叉键退出

		if (DWControlsManager.getInstance().contains(m_ret_frame)) {
			if (m_ret_frame != null) {
				DWControlsManager.getInstance().removeControl(m_ret_frame);
			}
		}
		m_ret_frame = new DWFrame(DWGameManager.Screen_Width - 200, DWGameManager.Screen_Height - 150);
		m_ret_frame.setCentre();
		m_ret_frame.setClickClose(false);
		DWControlsManager.getInstance().addControl(m_ret_frame);

		///////小背景
		m_xbj_bg = new DWBackground(DWGameManager.Screen_Width - 200, DWGameManager.Screen_Height - 150);
		m_xbj_bg.setNearAnchor(m_ret_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		///////标题
		m_rt_tit = new DWTitle("", m_ret_frame);
		m_rt_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8, 0);
		m_rt_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16, m_rt_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_rt_tit, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		///////退出按键
		DWImageBox m_tuichu_ima = new DWImageBox(m_cr_tuichu);
		m_tuichu_ima.setTouchZoomIn(40, 40);
		m_tuichu_ima.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				DWControlsManager.getInstance().removeControl(m_ret_frame);
			}
		});
		m_tuichu_ima.setNearAnchor(m_rt_tit, Tools.RIGHT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);

		//////账号和密码的标签
		///标签1
		m_rt_lab1 = new DWLabel("已绑定的手机号");
		m_rt_lab1.setBackgroundColor(Tools.ALPHA);
		m_rt_lab1.setTextColor(0xFFFFBB11);
		m_rt_lab1.setShowWideHigh(m_rt_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		///标签2
		m_rt_lab2 = new DWLabel("已绑定的邮箱");
		m_rt_lab2.setBackgroundColor(Tools.ALPHA);
		m_rt_lab2.setTextColor(0xFFFFBB11);
		m_rt_lab2.setShowWideHigh(m_rt_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);

		/////2个输入框
		m_rt_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_ret_frame);
		m_rt_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_ret_frame);

		///textbox 3
		m_rt_tb = new DWTextbox("<mark c=55FF00>" + "输入绑定的手机号、绑定的邮箱，请您去邮箱查找密码。" + "</mark>",
				m_rt_ib2.getShowWidth() + m_rt_lab2.getShowWidth() + 130);
		int m_y = (m_xbj_bg.getShowHeight() - 2 * m_rt_lab1.getShowHeight() - m_rt_tb.getShowHeight()
				- m_cr_button.getHeight() - 20) / 4;
		///1
		m_rt_lab1.setNearAnchor(
				m_xbj_bg,
				Tools.LEFT_TOP,
				Tools.LEFT_TOP,
				m_xbj_bg.getShowWidth() / 4, m_y);
		///2
		m_rt_lab2.setNearAnchor(m_rt_lab1, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);
		////3
		m_rt_tb.setNearAnchor(m_rt_lab2, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, -50, m_y);

		////2个输入框停靠位置
		m_rt_ib1.setNearAnchor(m_rt_lab1, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20, 0);
		m_rt_ib2.setNearAnchor(m_rt_lab2, Tools.LEFT_TOP, Tools.RIGHT_TOP, 20, 0);

		/////////按钮
		m_rt_but1 = new DWButton("找回密码", m_cr_button);
		m_rt_but1.setDownImage(m_cr_but_bianhou);
		m_rt_but1.addListener(rt_button1_lis);
		m_rt_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -20, -20);

		m_ret_frame.addControl(m_xbj_bg);
		m_ret_frame.addControl(m_rt_tit);
		m_ret_frame.addControl(m_tit_ima);
		m_ret_frame.addControl(m_tuichu_ima);
		m_ret_frame.addControl(m_rt_but1);
		m_ret_frame.addControl(m_rt_ib1);
		m_ret_frame.addControl(m_rt_ib2);
		m_ret_frame.addControl(m_rt_lab1);
		m_ret_frame.addControl(m_rt_lab2);
		m_ret_frame.addControl(m_rt_tb);
	}

	public DWInputBox m_ub_ib1;
	public DWInputBox m_ub_ib2;
	public DWTitle m_ub_tit;
	public DWLabel m_ub_lab1;
	public DWLabel m_ub_lab2;
	public DWTextbox m_ub_t_1;
	public DWTextbox m_ub_t_2;
	public DWButton m_ub_but1;

	public DWFrame m_unbind_frame = null;

	public void UnBind()
	{
		m_cr_tit = UIWindows.createImage("/img/newui/jiechubangding_1.gnp");
		m_cr_dbj = UIWindows.createImage("/img/newui/denglubjt_1.gnp"); /////大背景

		m_cr_button = UIWindows.createImage("/img/newui/anniu_6.gnp"); ////按钮的图片
		m_cr_but_bianhou = UIWindows.createImage("/img/newui/anniu_6ax.gnp"); ////按钮点击后变的图片

		m_cr_tuichu = UIWindows.createImage("/img/newui/fanhuianniu_1.gnp"); /////叉键退出

		if (DWControlsManager.getInstance().contains(m_unbind_frame)) {
			if (m_unbind_frame != null) {
				DWControlsManager.getInstance().removeControl(m_unbind_frame);
			}
		}
		m_unbind_frame = new DWFrame(DWGameManager.Screen_Width - 200, DWGameManager.Screen_Height - 150);
		m_unbind_frame.setCentre();
		m_unbind_frame.setClickClose(false);
		DWControlsManager.getInstance().addControl(m_unbind_frame);

		///////小背景
		m_xbj_bg = new DWBackground(DWGameManager.Screen_Width - 200, DWGameManager.Screen_Height - 150);
		m_xbj_bg.setNearAnchor(m_unbind_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		///////标题
		m_ub_tit = new DWTitle("", m_unbind_frame);
		m_ub_tit.setNearAnchor(m_xbj_bg, Tools.LEFT_BOTTOM, Tools.LEFT_TOP, -8, 0);
		m_ub_tit.setShowWideHigh(m_xbj_bg.getShowWidth() + 16, m_ub_tit.getShowHeight());
		m_tit_ima = new DWImageBox(m_cr_tit);
		m_tit_ima.setNearAnchor(m_ub_tit, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		///////退出按键
		DWImageBox m_tuichu_ima = new DWImageBox(m_cr_tuichu);
		m_tuichu_ima.setTouchZoomIn(40, 40);
		m_tuichu_ima.addListener(new DWListener() {

			public void OnDoubleClick()
			{
			}

			public void OnClick()
			{
				DWControlsManager.getInstance().removeControl(m_unbind_frame);
			}
		});
		m_tuichu_ima.setNearAnchor(m_ub_tit, Tools.RIGHT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);

		//////账号和密码的标签
		m_ub_lab1 = new DWLabel("已绑定的账号");
		m_ub_lab1.setBackgroundColor(Tools.ALPHA);
		m_ub_lab1.setTextColor(0xFFFFBB11);

		m_ub_lab2 = new DWLabel("账号的密码");
		m_ub_lab2.setBackgroundColor(Tools.ALPHA);
		m_ub_lab2.setTextColor(0xFFFFBB11);

		int m_y = (m_xbj_bg.getShowHeight() - 2 * m_ub_lab1.getShowHeight() - m_cr_button.getHeight() - 20) / 3;
		m_ub_lab1.setShowWideHigh(m_ub_lab1.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_ub_lab1
				.setNearAnchor(m_xbj_bg, Tools.LEFT_TOP,
						Tools.LEFT_TOP, m_xbj_bg.getShowWidth() / 4 - 10, m_y);

		m_ub_lab2.setShowWideHigh(m_ub_lab2.getShowWidth(), DWFont.getDefaultFont().getHeight() + 5);
		m_ub_lab2.setNearAnchor(m_ub_lab1, Tools.RIGHT_TOP,
				Tools.RIGHT_BOTTOM, 0, m_y);

		Login.Read();
		/////2个输入框
		m_ub_ib1 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_unbind_frame);
		m_ub_ib1.setText(Login.m_back_l_ib1);
		m_ub_ib1.setNearAnchor(m_ub_lab1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		m_ub_t_1 = new DWTextbox("(6~11个数字或字母)");
		m_ub_t_1.setNearAnchor(m_ub_ib1, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		m_ub_ib2 = new DWInputBox(m_xbj_bg.getShowWidth() / 3, DWFont.getDefaultFont().getHeight() + 5, m_unbind_frame);
		m_ub_ib2.setNearAnchor(m_ub_lab2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 20, 0);
		m_ub_t_2 = new DWTextbox("(6~11个数字或字母)");
		m_ub_t_2.setNearAnchor(m_ub_ib2, Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 5, 0);

		m_ub_but1 = new DWButton("解除绑定", m_cr_button);
		m_ub_but1.setDownImage(m_cr_but_bianhou);
		m_ub_but1.addListener(ub_button1_lis);
		m_ub_but1.setNearAnchor(m_xbj_bg, Tools.RIGHT_BOTTOM,
				Tools.RIGHT_BOTTOM, -20, -30);

		m_unbind_frame.addControl(m_xbj_bg);
		m_unbind_frame.addControl(m_ub_tit);
		m_unbind_frame.addControl(m_tit_ima);
		m_unbind_frame.addControl(m_tuichu_ima);
		m_unbind_frame.addControl(m_ub_but1);
		m_unbind_frame.addControl(m_ub_ib1);
		m_unbind_frame.addControl(m_ub_ib2);
		m_unbind_frame.addControl(m_ub_lab1);
		m_unbind_frame.addControl(m_ub_lab2);
		m_unbind_frame.addControl(m_ub_t_1);
		m_unbind_frame.addControl(m_ub_t_2);
	}

	private DWListener rt_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{

		}

		public void OnClick()
		{
			if (m_rt_ib1.getText() == null || m_rt_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("已绑定的手机号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionNumbers(m_rt_ib1.getText())) {
					DWGameManager.getInstance().showToast("已绑定的手机号必须全是数字格式!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_rt_ib1.getText().length() != 11) {
						DWGameManager.getInstance().showToast(
								"已绑定的手机号格式不对!", Toast.LENGTH_LONG);
					}
					else {
						if (m_rt_ib2.getText() == null
								|| m_rt_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast(
									"已绑定的邮箱不能为空!", Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection.detectionMail(m_rt_ib2.getText()))
							{
								DWGameManager.getInstance().showToast(
										"已绑定的邮箱格式不对!", Toast.LENGTH_LONG);
							}
							else
							{
								DWGameManager.getInstance().getSendMessage()
										.sendUserRetrievePassword(
												m_rt_ib1.getText(),
												m_rt_ib2.getText());
							}
						}
					}
				}
			}
		}
	};

	private DWListener ub_button1_lis = new DWListener() {

		public void OnDoubleClick()
		{
		}

		public void OnClick()
		{
			if (m_ub_ib1.getText() == null || m_ub_ib1.getText().equals("")) {
				DWGameManager.getInstance().showToast("已绑定的账号不能为空!",
						Toast.LENGTH_LONG);
			}
			else {
				if (!DWCharsDetection.detectionLetterNumbers(m_ub_ib1.getText())) {
					DWGameManager.getInstance().showToast("已绑定的账号只允许输入数字与字母!",
							Toast.LENGTH_LONG);
				}
				else {
					if (m_ub_ib1.getText().length() < 6) {
						DWGameManager.getInstance().showToast(
								"已绑定的账号不能少于6个字符!", Toast.LENGTH_LONG);
					}
					else if (m_ub_ib1.getText().length() > 11) {
						DWGameManager.getInstance().showToast(
								"已绑定的账号不能高于11个字符!", Toast.LENGTH_LONG);
					}
					else {
						if (m_ub_ib2.getText() == null
								|| m_ub_ib2.getText().equals("")) {
							DWGameManager.getInstance().showToast("账号的密码不能为空!",
									Toast.LENGTH_LONG);
						}
						else {
							if (!DWCharsDetection.detectionLetterNumbers(m_ub_ib2.getText())) {
								DWGameManager.getInstance().showToast(
										"账号的密码只允许输入数字与字母!", Toast.LENGTH_LONG);
							}
							else {
								if (m_ub_ib2.getText().length() < 4) {
									DWGameManager.getInstance()
											.showToast("账号的密码不能少于4个字符!",
													Toast.LENGTH_LONG);
								}
								else if (m_ub_ib2.getText().length() > 11) {
									DWGameManager.getInstance().showToast(
											"账号的密码不能高于11个字符!",
											Toast.LENGTH_LONG);
								}
								else {
									DWGameManager.getInstance()
											.getSendMessage().sendUserUnbind(
													m_ub_ib1.getText(),
													m_ub_ib2.getText());
								}
							}
						}
					}
				}
			}
		}
	};

	/**
	 * 重置控件
	 */
	public void reset()
	{
		try {
			updateSkillSet();
			updateLv();
			updateExp();
			updateMyHead();
			updateOpenIcon();
			refreshMapName();
			resetDazhao();
			updateTeam();
			updateMyBuff();
			removeFuBenIcon();
			UIWindows.getInstance().m_firstRecharge.setIcon();
		}
		catch (Exception e) {
			Tools.debug(e);
		}
	}

	/**
	 * yichu fuben icon
	 */
	public void removeFuBenIcon()
	{
		if (m_Uimain_Frame.contains(UIWindows.getInstance().m_facarbon.m_de_but))
		{
			m_Uimain_Frame.removeControl(UIWindows.getInstance().m_facarbon.m_de_but);
		}
		if (m_Uimain_Frame.contains(m_jingji_bg))
		{
			m_jingji_bg.setShow(false);
		}
		if (m_Uimain_Frame.contains(m_jingji_tb))
		{
			m_jingji_tb.setShow(false);
		}
		if (m_Uimain_Frame.contains(UIWindows.getInstance().m_shura_battle.m_right_listbox_bg)
				&& m_Uimain_Frame.contains(UIWindows.getInstance().m_shura_battle.m_right_listbox))
		{
			m_Uimain_Frame.removeControl(UIWindows.getInstance().m_shura_battle.m_right_listbox_bg);
			m_Uimain_Frame.removeControl(UIWindows.getInstance().m_shura_battle.m_right_listbox);
		}
	}

	public void resetDazhao()
	{
		if (m_animBox_dazhao_head != null) {
			m_animBox_dazhao_head.setShow(false);
			m_animBox_dazhao_head.setTouch(false);
		}
		if (m_animBox_dazhao_center != null) {
			m_animBox_dazhao_center.setShow(false);
			m_animBox_dazhao_center.setTouch(false);
		}
		if (m_grid_dazhao != null) {
			m_grid_dazhao.setShow(false);
			m_grid_dazhao.setTouch(false);
		}
	}

	public long m_changjing_start_time = 0;

	public void ChangjingTime()
	{
		if (m_tongji_buff)
		{
			if (m_tongji_time > 0) {
				if (m_changjing_start_time == 0) {
					m_changjing_start_time = System.currentTimeMillis();// 读取时截取系统时间
				}
				long currentTime = System.currentTimeMillis();// 当前系统时间
				int index = (int) (m_tongji_time - (currentTime - m_changjing_start_time) / 1000);

				if (index < 0) {
					m_tongji_buff = false;
					m_changjing_start_time = 0;
					if (m_tongjibuff_time != null) {
						m_tongjibuff_time.setShow(false);
						m_tongji.setShow(false);
					}
					m_changjing_start_time = 0;
					m_tongji_time = 0;
				}
				else {

					if (m_tongjibuff_time != null) {
						m_tongjibuff_time.setText("<mark c=EEF5A8>" + "虚弱：" + (index / 60) + " : " + (index % 60)
								+ "</mark>");
						m_tongjibuff_time.setShow(true);
						m_tongji.setShow(true);
					}

				}
			}

		}
	}

	/**
	 * 返回颁奖图标
	 */
	public DWImageBox getBanJiangIcon()
	{
		if (m_imageBox_banjiang != null && m_imageBox_banjiang.isShow()) {
			return m_imageBox_banjiang;
		}
		return null;
	}

}
